diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json b/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json
index e4d9ef0f2597..69130b1e60ab 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json
@@ -1,11 +1,11 @@
{
- "commit": "44d7a32482656b3a79a2fa11ac27c981f8e0e3cd",
+ "commit": "a12f06bc4e4f1ff04718892feb1be056ecdb3f9b",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
- "autorest": "3.9.7",
+ "autorest": "3.10.2",
"use": [
- "@autorest/python@6.13.7",
+ "@autorest/python@6.19.0",
"@autorest/modelerfour@4.27.0"
],
- "autorest_command": "autorest specification/apimanagement/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-2022-08 --use=@autorest/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False",
+ "autorest_command": "autorest specification/apimanagement/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
"readme": "specification/apimanagement/resource-manager/readme.md"
}
\ No newline at end of file
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 b27dedf560d2..bcbe1d697d69 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
@@ -8,6 +8,7 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
@@ -18,16 +19,22 @@
from ._configuration import ApiManagementClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
+ AllPoliciesOperations,
ApiDiagnosticOperations,
ApiExportOperations,
+ ApiGatewayConfigConnectionOperations,
+ ApiGatewayOperations,
ApiIssueAttachmentOperations,
ApiIssueCommentOperations,
ApiIssueOperations,
ApiManagementClientOperationsMixin,
+ ApiManagementGatewaySkusOperations,
ApiManagementOperationsOperations,
ApiManagementServiceOperations,
ApiManagementServiceSkusOperations,
ApiManagementSkusOperations,
+ ApiManagementWorkspaceLinkOperations,
+ ApiManagementWorkspaceLinksOperations,
ApiOperationOperations,
ApiOperationPolicyOperations,
ApiOperations,
@@ -74,15 +81,21 @@
NotificationRecipientUserOperations,
OpenIdConnectProviderOperations,
OperationOperations,
+ OperationStatusOperations,
+ OperationsResultsOperations,
OutboundNetworkDependenciesEndpointsOperations,
PolicyDescriptionOperations,
PolicyFragmentOperations,
PolicyOperations,
+ PolicyRestrictionOperations,
+ PolicyRestrictionValidationsOperations,
PortalConfigOperations,
PortalRevisionOperations,
PortalSettingsOperations,
PrivateEndpointConnectionOperations,
+ ProductApiLinkOperations,
ProductApiOperations,
+ ProductGroupLinkOperations,
ProductGroupOperations,
ProductOperations,
ProductPolicyOperations,
@@ -96,7 +109,10 @@
SignInSettingsOperations,
SignUpSettingsOperations,
SubscriptionOperations,
+ TagApiLinkOperations,
+ TagOperationLinkOperations,
TagOperations,
+ TagProductLinkOperations,
TagResourceOperations,
TenantAccessGitOperations,
TenantAccessOperations,
@@ -107,6 +123,39 @@
UserIdentitiesOperations,
UserOperations,
UserSubscriptionOperations,
+ WorkspaceApiDiagnosticOperations,
+ WorkspaceApiExportOperations,
+ WorkspaceApiOperationOperations,
+ WorkspaceApiOperationPolicyOperations,
+ WorkspaceApiOperations,
+ WorkspaceApiPolicyOperations,
+ WorkspaceApiReleaseOperations,
+ WorkspaceApiRevisionOperations,
+ WorkspaceApiSchemaOperations,
+ WorkspaceApiVersionSetOperations,
+ WorkspaceBackendOperations,
+ WorkspaceCertificateOperations,
+ WorkspaceDiagnosticOperations,
+ WorkspaceGlobalSchemaOperations,
+ WorkspaceGroupOperations,
+ WorkspaceGroupUserOperations,
+ WorkspaceLoggerOperations,
+ WorkspaceNamedValueOperations,
+ WorkspaceNotificationOperations,
+ WorkspaceNotificationRecipientEmailOperations,
+ WorkspaceNotificationRecipientUserOperations,
+ WorkspaceOperations,
+ WorkspacePolicyFragmentOperations,
+ WorkspacePolicyOperations,
+ WorkspaceProductApiLinkOperations,
+ WorkspaceProductGroupLinkOperations,
+ WorkspaceProductOperations,
+ WorkspaceProductPolicyOperations,
+ WorkspaceSubscriptionOperations,
+ WorkspaceTagApiLinkOperations,
+ WorkspaceTagOperationLinkOperations,
+ WorkspaceTagOperations,
+ WorkspaceTagProductLinkOperations,
)
if TYPE_CHECKING:
@@ -119,6 +168,13 @@ class ApiManagementClient(
): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""ApiManagement Client.
+ :ivar api_gateway: ApiGatewayOperations operations
+ :vartype api_gateway: azure.mgmt.apimanagement.operations.ApiGatewayOperations
+ :ivar api_management_gateway_skus: ApiManagementGatewaySkusOperations operations
+ :vartype api_management_gateway_skus:
+ azure.mgmt.apimanagement.operations.ApiManagementGatewaySkusOperations
+ :ivar all_policies: AllPoliciesOperations operations
+ :vartype all_policies: azure.mgmt.apimanagement.operations.AllPoliciesOperations
:ivar api: ApiOperations operations
:vartype api: azure.mgmt.apimanagement.operations.ApiOperations
:ivar api_revision: ApiRevisionOperations operations
@@ -163,9 +219,6 @@ class ApiManagementClient(
:vartype api_export: azure.mgmt.apimanagement.operations.ApiExportOperations
: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
:ivar authorization_provider: AuthorizationProviderOperations operations
:vartype authorization_provider:
azure.mgmt.apimanagement.operations.AuthorizationProviderOperations
@@ -177,6 +230,9 @@ class ApiManagementClient(
:ivar authorization_access_policy: AuthorizationAccessPolicyOperations operations
:vartype authorization_access_policy:
azure.mgmt.apimanagement.operations.AuthorizationAccessPolicyOperations
+ :ivar authorization_server: AuthorizationServerOperations operations
+ :vartype authorization_server:
+ azure.mgmt.apimanagement.operations.AuthorizationServerOperations
:ivar backend: BackendOperations operations
:vartype backend: azure.mgmt.apimanagement.operations.BackendOperations
:ivar cache: CacheOperations operations
@@ -200,8 +256,13 @@ class ApiManagementClient(
azure.mgmt.apimanagement.operations.ApiManagementServiceOperations
:ivar diagnostic: DiagnosticOperations operations
:vartype diagnostic: azure.mgmt.apimanagement.operations.DiagnosticOperations
+ :ivar documentation: DocumentationOperations operations
+ :vartype documentation: azure.mgmt.apimanagement.operations.DocumentationOperations
:ivar email_template: EmailTemplateOperations operations
:vartype email_template: azure.mgmt.apimanagement.operations.EmailTemplateOperations
+ :ivar api_gateway_config_connection: ApiGatewayConfigConnectionOperations operations
+ :vartype api_gateway_config_connection:
+ azure.mgmt.apimanagement.operations.ApiGatewayConfigConnectionOperations
:ivar gateway: GatewayOperations operations
:vartype gateway: azure.mgmt.apimanagement.operations.GatewayOperations
:ivar gateway_hostname_configuration: GatewayHostnameConfigurationOperations operations
@@ -247,6 +308,11 @@ class ApiManagementClient(
:vartype policy_description: azure.mgmt.apimanagement.operations.PolicyDescriptionOperations
:ivar policy_fragment: PolicyFragmentOperations operations
:vartype policy_fragment: azure.mgmt.apimanagement.operations.PolicyFragmentOperations
+ :ivar policy_restriction: PolicyRestrictionOperations operations
+ :vartype policy_restriction: azure.mgmt.apimanagement.operations.PolicyRestrictionOperations
+ :ivar policy_restriction_validations: PolicyRestrictionValidationsOperations operations
+ :vartype policy_restriction_validations:
+ azure.mgmt.apimanagement.operations.PolicyRestrictionValidationsOperations
:ivar portal_config: PortalConfigOperations operations
:vartype portal_config: azure.mgmt.apimanagement.operations.PortalConfigOperations
:ivar portal_revision: PortalRevisionOperations operations
@@ -277,6 +343,10 @@ class ApiManagementClient(
:vartype product_wiki: azure.mgmt.apimanagement.operations.ProductWikiOperations
:ivar product_wikis: ProductWikisOperations operations
:vartype product_wikis: azure.mgmt.apimanagement.operations.ProductWikisOperations
+ :ivar product_api_link: ProductApiLinkOperations operations
+ :vartype product_api_link: azure.mgmt.apimanagement.operations.ProductApiLinkOperations
+ :ivar product_group_link: ProductGroupLinkOperations operations
+ :vartype product_group_link: azure.mgmt.apimanagement.operations.ProductGroupLinkOperations
:ivar quota_by_counter_keys: QuotaByCounterKeysOperations operations
:vartype quota_by_counter_keys:
azure.mgmt.apimanagement.operations.QuotaByCounterKeysOperations
@@ -296,6 +366,12 @@ class ApiManagementClient(
:vartype subscription: azure.mgmt.apimanagement.operations.SubscriptionOperations
:ivar tag_resource: TagResourceOperations operations
:vartype tag_resource: azure.mgmt.apimanagement.operations.TagResourceOperations
+ :ivar tag_api_link: TagApiLinkOperations operations
+ :vartype tag_api_link: azure.mgmt.apimanagement.operations.TagApiLinkOperations
+ :ivar tag_operation_link: TagOperationLinkOperations operations
+ :vartype tag_operation_link: azure.mgmt.apimanagement.operations.TagOperationLinkOperations
+ :ivar tag_product_link: TagProductLinkOperations operations
+ :vartype tag_product_link: azure.mgmt.apimanagement.operations.TagProductLinkOperations
:ivar tenant_access: TenantAccessOperations operations
:vartype tenant_access: azure.mgmt.apimanagement.operations.TenantAccessOperations
:ivar tenant_access_git: TenantAccessGitOperations operations
@@ -314,16 +390,113 @@ class ApiManagementClient(
:ivar user_confirmation_password: UserConfirmationPasswordOperations operations
:vartype user_confirmation_password:
azure.mgmt.apimanagement.operations.UserConfirmationPasswordOperations
- :ivar documentation: DocumentationOperations operations
- :vartype documentation: azure.mgmt.apimanagement.operations.DocumentationOperations
+ :ivar workspace_backend: WorkspaceBackendOperations operations
+ :vartype workspace_backend: azure.mgmt.apimanagement.operations.WorkspaceBackendOperations
+ :ivar workspace_certificate: WorkspaceCertificateOperations operations
+ :vartype workspace_certificate:
+ azure.mgmt.apimanagement.operations.WorkspaceCertificateOperations
+ :ivar workspace_diagnostic: WorkspaceDiagnosticOperations operations
+ :vartype workspace_diagnostic:
+ azure.mgmt.apimanagement.operations.WorkspaceDiagnosticOperations
+ :ivar workspace_api_diagnostic: WorkspaceApiDiagnosticOperations operations
+ :vartype workspace_api_diagnostic:
+ azure.mgmt.apimanagement.operations.WorkspaceApiDiagnosticOperations
+ :ivar api_management_workspace_links: ApiManagementWorkspaceLinksOperations operations
+ :vartype api_management_workspace_links:
+ azure.mgmt.apimanagement.operations.ApiManagementWorkspaceLinksOperations
+ :ivar api_management_workspace_link: ApiManagementWorkspaceLinkOperations operations
+ :vartype api_management_workspace_link:
+ azure.mgmt.apimanagement.operations.ApiManagementWorkspaceLinkOperations
+ :ivar workspace_logger: WorkspaceLoggerOperations operations
+ :vartype workspace_logger: azure.mgmt.apimanagement.operations.WorkspaceLoggerOperations
+ :ivar workspace: WorkspaceOperations operations
+ :vartype workspace: azure.mgmt.apimanagement.operations.WorkspaceOperations
+ :ivar workspace_policy: WorkspacePolicyOperations operations
+ :vartype workspace_policy: azure.mgmt.apimanagement.operations.WorkspacePolicyOperations
+ :ivar workspace_named_value: WorkspaceNamedValueOperations operations
+ :vartype workspace_named_value:
+ azure.mgmt.apimanagement.operations.WorkspaceNamedValueOperations
+ :ivar workspace_global_schema: WorkspaceGlobalSchemaOperations operations
+ :vartype workspace_global_schema:
+ azure.mgmt.apimanagement.operations.WorkspaceGlobalSchemaOperations
+ :ivar workspace_notification: WorkspaceNotificationOperations operations
+ :vartype workspace_notification:
+ azure.mgmt.apimanagement.operations.WorkspaceNotificationOperations
+ :ivar workspace_notification_recipient_user: WorkspaceNotificationRecipientUserOperations
+ operations
+ :vartype workspace_notification_recipient_user:
+ azure.mgmt.apimanagement.operations.WorkspaceNotificationRecipientUserOperations
+ :ivar workspace_notification_recipient_email: WorkspaceNotificationRecipientEmailOperations
+ operations
+ :vartype workspace_notification_recipient_email:
+ azure.mgmt.apimanagement.operations.WorkspaceNotificationRecipientEmailOperations
+ :ivar workspace_policy_fragment: WorkspacePolicyFragmentOperations operations
+ :vartype workspace_policy_fragment:
+ azure.mgmt.apimanagement.operations.WorkspacePolicyFragmentOperations
+ :ivar workspace_group: WorkspaceGroupOperations operations
+ :vartype workspace_group: azure.mgmt.apimanagement.operations.WorkspaceGroupOperations
+ :ivar workspace_group_user: WorkspaceGroupUserOperations operations
+ :vartype workspace_group_user: azure.mgmt.apimanagement.operations.WorkspaceGroupUserOperations
+ :ivar workspace_subscription: WorkspaceSubscriptionOperations operations
+ :vartype workspace_subscription:
+ azure.mgmt.apimanagement.operations.WorkspaceSubscriptionOperations
+ :ivar workspace_api_version_set: WorkspaceApiVersionSetOperations operations
+ :vartype workspace_api_version_set:
+ azure.mgmt.apimanagement.operations.WorkspaceApiVersionSetOperations
+ :ivar workspace_api: WorkspaceApiOperations operations
+ :vartype workspace_api: azure.mgmt.apimanagement.operations.WorkspaceApiOperations
+ :ivar workspace_api_revision: WorkspaceApiRevisionOperations operations
+ :vartype workspace_api_revision:
+ azure.mgmt.apimanagement.operations.WorkspaceApiRevisionOperations
+ :ivar workspace_api_release: WorkspaceApiReleaseOperations operations
+ :vartype workspace_api_release:
+ azure.mgmt.apimanagement.operations.WorkspaceApiReleaseOperations
+ :ivar workspace_api_operation: WorkspaceApiOperationOperations operations
+ :vartype workspace_api_operation:
+ azure.mgmt.apimanagement.operations.WorkspaceApiOperationOperations
+ :ivar workspace_api_operation_policy: WorkspaceApiOperationPolicyOperations operations
+ :vartype workspace_api_operation_policy:
+ azure.mgmt.apimanagement.operations.WorkspaceApiOperationPolicyOperations
+ :ivar workspace_api_policy: WorkspaceApiPolicyOperations operations
+ :vartype workspace_api_policy: azure.mgmt.apimanagement.operations.WorkspaceApiPolicyOperations
+ :ivar workspace_api_schema: WorkspaceApiSchemaOperations operations
+ :vartype workspace_api_schema: azure.mgmt.apimanagement.operations.WorkspaceApiSchemaOperations
+ :ivar workspace_product: WorkspaceProductOperations operations
+ :vartype workspace_product: azure.mgmt.apimanagement.operations.WorkspaceProductOperations
+ :ivar workspace_product_api_link: WorkspaceProductApiLinkOperations operations
+ :vartype workspace_product_api_link:
+ azure.mgmt.apimanagement.operations.WorkspaceProductApiLinkOperations
+ :ivar workspace_product_group_link: WorkspaceProductGroupLinkOperations operations
+ :vartype workspace_product_group_link:
+ azure.mgmt.apimanagement.operations.WorkspaceProductGroupLinkOperations
+ :ivar workspace_product_policy: WorkspaceProductPolicyOperations operations
+ :vartype workspace_product_policy:
+ azure.mgmt.apimanagement.operations.WorkspaceProductPolicyOperations
+ :ivar workspace_tag: WorkspaceTagOperations operations
+ :vartype workspace_tag: azure.mgmt.apimanagement.operations.WorkspaceTagOperations
+ :ivar workspace_tag_api_link: WorkspaceTagApiLinkOperations operations
+ :vartype workspace_tag_api_link:
+ azure.mgmt.apimanagement.operations.WorkspaceTagApiLinkOperations
+ :ivar workspace_tag_operation_link: WorkspaceTagOperationLinkOperations operations
+ :vartype workspace_tag_operation_link:
+ azure.mgmt.apimanagement.operations.WorkspaceTagOperationLinkOperations
+ :ivar workspace_tag_product_link: WorkspaceTagProductLinkOperations operations
+ :vartype workspace_tag_product_link:
+ azure.mgmt.apimanagement.operations.WorkspaceTagProductLinkOperations
+ :ivar workspace_api_export: WorkspaceApiExportOperations operations
+ :vartype workspace_api_export: azure.mgmt.apimanagement.operations.WorkspaceApiExportOperations
+ :ivar operation_status: OperationStatusOperations operations
+ :vartype operation_status: azure.mgmt.apimanagement.operations.OperationStatusOperations
+ :ivar operations_results: OperationsResultsOperations operations
+ :vartype operations_results: azure.mgmt.apimanagement.operations.OperationsResultsOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
- :param subscription_id: The ID of the target subscription. Required.
+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
- :keyword api_version: Api Version. Default value is "2022-08-01". Note that overriding this
- default value may result in unsupported behavior.
+ :keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding
+ this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
@@ -363,6 +536,11 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
+ self.api_gateway = ApiGatewayOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.api_management_gateway_skus = ApiManagementGatewaySkusOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.all_policies = AllPoliciesOperations(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)
@@ -396,9 +574,6 @@ def __init__(
self.api_wikis = ApiWikisOperations(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.authorization_provider = AuthorizationProviderOperations(
self._client, self._config, self._serialize, self._deserialize
)
@@ -409,6 +584,9 @@ def __init__(
self.authorization_access_policy = AuthorizationAccessPolicyOperations(
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)
@@ -427,7 +605,11 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize
)
self.diagnostic = DiagnosticOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.documentation = DocumentationOperations(self._client, self._config, self._serialize, self._deserialize)
self.email_template = EmailTemplateOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.api_gateway_config_connection = ApiGatewayConfigConnectionOperations(
+ 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
@@ -463,6 +645,12 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize
)
self.policy_fragment = PolicyFragmentOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.policy_restriction = PolicyRestrictionOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.policy_restriction_validations = PolicyRestrictionValidationsOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.portal_config = PortalConfigOperations(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)
@@ -483,6 +671,10 @@ def __init__(
self.product_policy = ProductPolicyOperations(self._client, self._config, self._serialize, self._deserialize)
self.product_wiki = ProductWikiOperations(self._client, self._config, self._serialize, self._deserialize)
self.product_wikis = ProductWikisOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.product_api_link = ProductApiLinkOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.product_group_link = ProductGroupLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.quota_by_counter_keys = QuotaByCounterKeysOperations(
self._client, self._config, self._serialize, self._deserialize
)
@@ -498,6 +690,11 @@ def __init__(
)
self.subscription = SubscriptionOperations(self._client, self._config, self._serialize, self._deserialize)
self.tag_resource = TagResourceOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.tag_api_link = TagApiLinkOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.tag_operation_link = TagOperationLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.tag_product_link = TagProductLinkOperations(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
@@ -514,7 +711,109 @@ def __init__(
self.user_confirmation_password = UserConfirmationPasswordOperations(
self._client, self._config, self._serialize, self._deserialize
)
- self.documentation = DocumentationOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.workspace_backend = WorkspaceBackendOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_certificate = WorkspaceCertificateOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_diagnostic = WorkspaceDiagnosticOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_diagnostic = WorkspaceApiDiagnosticOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.api_management_workspace_links = ApiManagementWorkspaceLinksOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.api_management_workspace_link = ApiManagementWorkspaceLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_logger = WorkspaceLoggerOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace = WorkspaceOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.workspace_policy = WorkspacePolicyOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_named_value = WorkspaceNamedValueOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_global_schema = WorkspaceGlobalSchemaOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_notification = WorkspaceNotificationOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_notification_recipient_user = WorkspaceNotificationRecipientUserOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_notification_recipient_email = WorkspaceNotificationRecipientEmailOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_policy_fragment = WorkspacePolicyFragmentOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_group = WorkspaceGroupOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.workspace_group_user = WorkspaceGroupUserOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_subscription = WorkspaceSubscriptionOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_version_set = WorkspaceApiVersionSetOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api = WorkspaceApiOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.workspace_api_revision = WorkspaceApiRevisionOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_release = WorkspaceApiReleaseOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_operation = WorkspaceApiOperationOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_operation_policy = WorkspaceApiOperationPolicyOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_policy = WorkspaceApiPolicyOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_schema = WorkspaceApiSchemaOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_product = WorkspaceProductOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_product_api_link = WorkspaceProductApiLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_product_group_link = WorkspaceProductGroupLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_product_policy = WorkspaceProductPolicyOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_tag = WorkspaceTagOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.workspace_tag_api_link = WorkspaceTagApiLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_tag_operation_link = WorkspaceTagOperationLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_tag_product_link = WorkspaceTagProductLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_export = WorkspaceApiExportOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.operation_status = OperationStatusOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.operations_results = OperationsResultsOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
@@ -541,7 +840,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "ApiManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
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 751176a90d42..3241a1e9f7d0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py
@@ -26,15 +26,15 @@ class ApiManagementClientConfiguration: # pylint: disable=too-many-instance-att
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
- :param subscription_id: The ID of the target subscription. Required.
+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
- :keyword api_version: Api Version. Default value is "2022-08-01". Note that overriding this
- default value may result in unsupported behavior.
+ :keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding
+ this default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- api_version: str = kwargs.pop("api_version", "2022-08-01")
+ api_version: str = kwargs.pop("api_version", "2024-06-01-preview")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_patch.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_patch.py
index f99e77fef986..17dbc073e01b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_patch.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_patch.py
@@ -25,6 +25,7 @@
#
# --------------------------------------------------------------------------
+
# 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():
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_serialization.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_serialization.py
index 2f781d740827..8139854b97bb 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_serialization.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_serialization.py
@@ -144,6 +144,8 @@ def _json_attemp(data):
# context otherwise.
_LOGGER.critical("Wasn't XML not JSON, failing")
raise DeserializationError("XML is invalid") from err
+ elif content_type.startswith("text/"):
+ return data_as_str
raise DeserializationError("Cannot deserialize content-type: {}".format(content_type))
@classmethod
@@ -1441,7 +1443,7 @@ def _deserialize(self, target_obj, data):
elif isinstance(response, type) and issubclass(response, Enum):
return self.deserialize_enum(data, response)
- if data is None:
+ if data is None or data is CoreNull:
return data
try:
attributes = response._attribute_map # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py
index ffe974b35563..45ee70ef5710 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py
@@ -8,8 +8,6 @@
from abc import ABC
from typing import TYPE_CHECKING
-from azure.core.pipeline.transport import HttpRequest
-
from ._configuration import ApiManagementClientConfiguration
if TYPE_CHECKING:
@@ -19,14 +17,6 @@
from ._serialization import Deserializer, Serializer
-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
-
-
class ApiManagementClientMixinABC(ABC):
"""DO NOT use this class. It is for internal typing use only."""
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 f4674910a502..e5754a47ce68 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 = "4.0.1"
+VERSION = "1.0.0b1"
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 8c472f3c2199..2feb6cfd0a63 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
@@ -8,6 +8,7 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
@@ -18,16 +19,22 @@
from .._serialization import Deserializer, Serializer
from ._configuration import ApiManagementClientConfiguration
from .operations import (
+ AllPoliciesOperations,
ApiDiagnosticOperations,
ApiExportOperations,
+ ApiGatewayConfigConnectionOperations,
+ ApiGatewayOperations,
ApiIssueAttachmentOperations,
ApiIssueCommentOperations,
ApiIssueOperations,
ApiManagementClientOperationsMixin,
+ ApiManagementGatewaySkusOperations,
ApiManagementOperationsOperations,
ApiManagementServiceOperations,
ApiManagementServiceSkusOperations,
ApiManagementSkusOperations,
+ ApiManagementWorkspaceLinkOperations,
+ ApiManagementWorkspaceLinksOperations,
ApiOperationOperations,
ApiOperationPolicyOperations,
ApiOperations,
@@ -74,15 +81,21 @@
NotificationRecipientUserOperations,
OpenIdConnectProviderOperations,
OperationOperations,
+ OperationStatusOperations,
+ OperationsResultsOperations,
OutboundNetworkDependenciesEndpointsOperations,
PolicyDescriptionOperations,
PolicyFragmentOperations,
PolicyOperations,
+ PolicyRestrictionOperations,
+ PolicyRestrictionValidationsOperations,
PortalConfigOperations,
PortalRevisionOperations,
PortalSettingsOperations,
PrivateEndpointConnectionOperations,
+ ProductApiLinkOperations,
ProductApiOperations,
+ ProductGroupLinkOperations,
ProductGroupOperations,
ProductOperations,
ProductPolicyOperations,
@@ -96,7 +109,10 @@
SignInSettingsOperations,
SignUpSettingsOperations,
SubscriptionOperations,
+ TagApiLinkOperations,
+ TagOperationLinkOperations,
TagOperations,
+ TagProductLinkOperations,
TagResourceOperations,
TenantAccessGitOperations,
TenantAccessOperations,
@@ -107,6 +123,39 @@
UserIdentitiesOperations,
UserOperations,
UserSubscriptionOperations,
+ WorkspaceApiDiagnosticOperations,
+ WorkspaceApiExportOperations,
+ WorkspaceApiOperationOperations,
+ WorkspaceApiOperationPolicyOperations,
+ WorkspaceApiOperations,
+ WorkspaceApiPolicyOperations,
+ WorkspaceApiReleaseOperations,
+ WorkspaceApiRevisionOperations,
+ WorkspaceApiSchemaOperations,
+ WorkspaceApiVersionSetOperations,
+ WorkspaceBackendOperations,
+ WorkspaceCertificateOperations,
+ WorkspaceDiagnosticOperations,
+ WorkspaceGlobalSchemaOperations,
+ WorkspaceGroupOperations,
+ WorkspaceGroupUserOperations,
+ WorkspaceLoggerOperations,
+ WorkspaceNamedValueOperations,
+ WorkspaceNotificationOperations,
+ WorkspaceNotificationRecipientEmailOperations,
+ WorkspaceNotificationRecipientUserOperations,
+ WorkspaceOperations,
+ WorkspacePolicyFragmentOperations,
+ WorkspacePolicyOperations,
+ WorkspaceProductApiLinkOperations,
+ WorkspaceProductGroupLinkOperations,
+ WorkspaceProductOperations,
+ WorkspaceProductPolicyOperations,
+ WorkspaceSubscriptionOperations,
+ WorkspaceTagApiLinkOperations,
+ WorkspaceTagOperationLinkOperations,
+ WorkspaceTagOperations,
+ WorkspaceTagProductLinkOperations,
)
if TYPE_CHECKING:
@@ -119,6 +168,13 @@ class ApiManagementClient(
): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""ApiManagement Client.
+ :ivar api_gateway: ApiGatewayOperations operations
+ :vartype api_gateway: azure.mgmt.apimanagement.aio.operations.ApiGatewayOperations
+ :ivar api_management_gateway_skus: ApiManagementGatewaySkusOperations operations
+ :vartype api_management_gateway_skus:
+ azure.mgmt.apimanagement.aio.operations.ApiManagementGatewaySkusOperations
+ :ivar all_policies: AllPoliciesOperations operations
+ :vartype all_policies: azure.mgmt.apimanagement.aio.operations.AllPoliciesOperations
:ivar api: ApiOperations operations
:vartype api: azure.mgmt.apimanagement.aio.operations.ApiOperations
:ivar api_revision: ApiRevisionOperations operations
@@ -166,9 +222,6 @@ class ApiManagementClient(
:vartype api_export: azure.mgmt.apimanagement.aio.operations.ApiExportOperations
: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
:ivar authorization_provider: AuthorizationProviderOperations operations
:vartype authorization_provider:
azure.mgmt.apimanagement.aio.operations.AuthorizationProviderOperations
@@ -180,6 +233,9 @@ class ApiManagementClient(
:ivar authorization_access_policy: AuthorizationAccessPolicyOperations operations
:vartype authorization_access_policy:
azure.mgmt.apimanagement.aio.operations.AuthorizationAccessPolicyOperations
+ :ivar authorization_server: AuthorizationServerOperations operations
+ :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
@@ -203,8 +259,13 @@ class ApiManagementClient(
azure.mgmt.apimanagement.aio.operations.ApiManagementServiceOperations
:ivar diagnostic: DiagnosticOperations operations
:vartype diagnostic: azure.mgmt.apimanagement.aio.operations.DiagnosticOperations
+ :ivar documentation: DocumentationOperations operations
+ :vartype documentation: azure.mgmt.apimanagement.aio.operations.DocumentationOperations
:ivar email_template: EmailTemplateOperations operations
:vartype email_template: azure.mgmt.apimanagement.aio.operations.EmailTemplateOperations
+ :ivar api_gateway_config_connection: ApiGatewayConfigConnectionOperations operations
+ :vartype api_gateway_config_connection:
+ azure.mgmt.apimanagement.aio.operations.ApiGatewayConfigConnectionOperations
:ivar gateway: GatewayOperations operations
:vartype gateway: azure.mgmt.apimanagement.aio.operations.GatewayOperations
:ivar gateway_hostname_configuration: GatewayHostnameConfigurationOperations operations
@@ -251,6 +312,12 @@ class ApiManagementClient(
azure.mgmt.apimanagement.aio.operations.PolicyDescriptionOperations
:ivar policy_fragment: PolicyFragmentOperations operations
:vartype policy_fragment: azure.mgmt.apimanagement.aio.operations.PolicyFragmentOperations
+ :ivar policy_restriction: PolicyRestrictionOperations operations
+ :vartype policy_restriction:
+ azure.mgmt.apimanagement.aio.operations.PolicyRestrictionOperations
+ :ivar policy_restriction_validations: PolicyRestrictionValidationsOperations operations
+ :vartype policy_restriction_validations:
+ azure.mgmt.apimanagement.aio.operations.PolicyRestrictionValidationsOperations
:ivar portal_config: PortalConfigOperations operations
:vartype portal_config: azure.mgmt.apimanagement.aio.operations.PortalConfigOperations
:ivar portal_revision: PortalRevisionOperations operations
@@ -282,6 +349,10 @@ class ApiManagementClient(
:vartype product_wiki: azure.mgmt.apimanagement.aio.operations.ProductWikiOperations
:ivar product_wikis: ProductWikisOperations operations
:vartype product_wikis: azure.mgmt.apimanagement.aio.operations.ProductWikisOperations
+ :ivar product_api_link: ProductApiLinkOperations operations
+ :vartype product_api_link: azure.mgmt.apimanagement.aio.operations.ProductApiLinkOperations
+ :ivar product_group_link: ProductGroupLinkOperations operations
+ :vartype product_group_link: azure.mgmt.apimanagement.aio.operations.ProductGroupLinkOperations
:ivar quota_by_counter_keys: QuotaByCounterKeysOperations operations
:vartype quota_by_counter_keys:
azure.mgmt.apimanagement.aio.operations.QuotaByCounterKeysOperations
@@ -303,6 +374,12 @@ class ApiManagementClient(
:vartype subscription: azure.mgmt.apimanagement.aio.operations.SubscriptionOperations
:ivar tag_resource: TagResourceOperations operations
:vartype tag_resource: azure.mgmt.apimanagement.aio.operations.TagResourceOperations
+ :ivar tag_api_link: TagApiLinkOperations operations
+ :vartype tag_api_link: azure.mgmt.apimanagement.aio.operations.TagApiLinkOperations
+ :ivar tag_operation_link: TagOperationLinkOperations operations
+ :vartype tag_operation_link: azure.mgmt.apimanagement.aio.operations.TagOperationLinkOperations
+ :ivar tag_product_link: TagProductLinkOperations operations
+ :vartype tag_product_link: azure.mgmt.apimanagement.aio.operations.TagProductLinkOperations
:ivar tenant_access: TenantAccessOperations operations
:vartype tenant_access: azure.mgmt.apimanagement.aio.operations.TenantAccessOperations
:ivar tenant_access_git: TenantAccessGitOperations operations
@@ -321,16 +398,118 @@ class ApiManagementClient(
:ivar user_confirmation_password: UserConfirmationPasswordOperations operations
:vartype user_confirmation_password:
azure.mgmt.apimanagement.aio.operations.UserConfirmationPasswordOperations
- :ivar documentation: DocumentationOperations operations
- :vartype documentation: azure.mgmt.apimanagement.aio.operations.DocumentationOperations
+ :ivar workspace_backend: WorkspaceBackendOperations operations
+ :vartype workspace_backend: azure.mgmt.apimanagement.aio.operations.WorkspaceBackendOperations
+ :ivar workspace_certificate: WorkspaceCertificateOperations operations
+ :vartype workspace_certificate:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceCertificateOperations
+ :ivar workspace_diagnostic: WorkspaceDiagnosticOperations operations
+ :vartype workspace_diagnostic:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceDiagnosticOperations
+ :ivar workspace_api_diagnostic: WorkspaceApiDiagnosticOperations operations
+ :vartype workspace_api_diagnostic:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceApiDiagnosticOperations
+ :ivar api_management_workspace_links: ApiManagementWorkspaceLinksOperations operations
+ :vartype api_management_workspace_links:
+ azure.mgmt.apimanagement.aio.operations.ApiManagementWorkspaceLinksOperations
+ :ivar api_management_workspace_link: ApiManagementWorkspaceLinkOperations operations
+ :vartype api_management_workspace_link:
+ azure.mgmt.apimanagement.aio.operations.ApiManagementWorkspaceLinkOperations
+ :ivar workspace_logger: WorkspaceLoggerOperations operations
+ :vartype workspace_logger: azure.mgmt.apimanagement.aio.operations.WorkspaceLoggerOperations
+ :ivar workspace: WorkspaceOperations operations
+ :vartype workspace: azure.mgmt.apimanagement.aio.operations.WorkspaceOperations
+ :ivar workspace_policy: WorkspacePolicyOperations operations
+ :vartype workspace_policy: azure.mgmt.apimanagement.aio.operations.WorkspacePolicyOperations
+ :ivar workspace_named_value: WorkspaceNamedValueOperations operations
+ :vartype workspace_named_value:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceNamedValueOperations
+ :ivar workspace_global_schema: WorkspaceGlobalSchemaOperations operations
+ :vartype workspace_global_schema:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceGlobalSchemaOperations
+ :ivar workspace_notification: WorkspaceNotificationOperations operations
+ :vartype workspace_notification:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceNotificationOperations
+ :ivar workspace_notification_recipient_user: WorkspaceNotificationRecipientUserOperations
+ operations
+ :vartype workspace_notification_recipient_user:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceNotificationRecipientUserOperations
+ :ivar workspace_notification_recipient_email: WorkspaceNotificationRecipientEmailOperations
+ operations
+ :vartype workspace_notification_recipient_email:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceNotificationRecipientEmailOperations
+ :ivar workspace_policy_fragment: WorkspacePolicyFragmentOperations operations
+ :vartype workspace_policy_fragment:
+ azure.mgmt.apimanagement.aio.operations.WorkspacePolicyFragmentOperations
+ :ivar workspace_group: WorkspaceGroupOperations operations
+ :vartype workspace_group: azure.mgmt.apimanagement.aio.operations.WorkspaceGroupOperations
+ :ivar workspace_group_user: WorkspaceGroupUserOperations operations
+ :vartype workspace_group_user:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceGroupUserOperations
+ :ivar workspace_subscription: WorkspaceSubscriptionOperations operations
+ :vartype workspace_subscription:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceSubscriptionOperations
+ :ivar workspace_api_version_set: WorkspaceApiVersionSetOperations operations
+ :vartype workspace_api_version_set:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceApiVersionSetOperations
+ :ivar workspace_api: WorkspaceApiOperations operations
+ :vartype workspace_api: azure.mgmt.apimanagement.aio.operations.WorkspaceApiOperations
+ :ivar workspace_api_revision: WorkspaceApiRevisionOperations operations
+ :vartype workspace_api_revision:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceApiRevisionOperations
+ :ivar workspace_api_release: WorkspaceApiReleaseOperations operations
+ :vartype workspace_api_release:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceApiReleaseOperations
+ :ivar workspace_api_operation: WorkspaceApiOperationOperations operations
+ :vartype workspace_api_operation:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceApiOperationOperations
+ :ivar workspace_api_operation_policy: WorkspaceApiOperationPolicyOperations operations
+ :vartype workspace_api_operation_policy:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceApiOperationPolicyOperations
+ :ivar workspace_api_policy: WorkspaceApiPolicyOperations operations
+ :vartype workspace_api_policy:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceApiPolicyOperations
+ :ivar workspace_api_schema: WorkspaceApiSchemaOperations operations
+ :vartype workspace_api_schema:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceApiSchemaOperations
+ :ivar workspace_product: WorkspaceProductOperations operations
+ :vartype workspace_product: azure.mgmt.apimanagement.aio.operations.WorkspaceProductOperations
+ :ivar workspace_product_api_link: WorkspaceProductApiLinkOperations operations
+ :vartype workspace_product_api_link:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceProductApiLinkOperations
+ :ivar workspace_product_group_link: WorkspaceProductGroupLinkOperations operations
+ :vartype workspace_product_group_link:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceProductGroupLinkOperations
+ :ivar workspace_product_policy: WorkspaceProductPolicyOperations operations
+ :vartype workspace_product_policy:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceProductPolicyOperations
+ :ivar workspace_tag: WorkspaceTagOperations operations
+ :vartype workspace_tag: azure.mgmt.apimanagement.aio.operations.WorkspaceTagOperations
+ :ivar workspace_tag_api_link: WorkspaceTagApiLinkOperations operations
+ :vartype workspace_tag_api_link:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceTagApiLinkOperations
+ :ivar workspace_tag_operation_link: WorkspaceTagOperationLinkOperations operations
+ :vartype workspace_tag_operation_link:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceTagOperationLinkOperations
+ :ivar workspace_tag_product_link: WorkspaceTagProductLinkOperations operations
+ :vartype workspace_tag_product_link:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceTagProductLinkOperations
+ :ivar workspace_api_export: WorkspaceApiExportOperations operations
+ :vartype workspace_api_export:
+ azure.mgmt.apimanagement.aio.operations.WorkspaceApiExportOperations
+ :ivar operation_status: OperationStatusOperations operations
+ :vartype operation_status: azure.mgmt.apimanagement.aio.operations.OperationStatusOperations
+ :ivar operations_results: OperationsResultsOperations operations
+ :vartype operations_results:
+ azure.mgmt.apimanagement.aio.operations.OperationsResultsOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
- :param subscription_id: The ID of the target subscription. Required.
+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
- :keyword api_version: Api Version. Default value is "2022-08-01". Note that overriding this
- default value may result in unsupported behavior.
+ :keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding
+ this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
@@ -370,6 +549,11 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
+ self.api_gateway = ApiGatewayOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.api_management_gateway_skus = ApiManagementGatewaySkusOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.all_policies = AllPoliciesOperations(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)
@@ -403,9 +587,6 @@ def __init__(
self.api_wikis = ApiWikisOperations(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.authorization_provider = AuthorizationProviderOperations(
self._client, self._config, self._serialize, self._deserialize
)
@@ -416,6 +597,9 @@ def __init__(
self.authorization_access_policy = AuthorizationAccessPolicyOperations(
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)
@@ -434,7 +618,11 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize
)
self.diagnostic = DiagnosticOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.documentation = DocumentationOperations(self._client, self._config, self._serialize, self._deserialize)
self.email_template = EmailTemplateOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.api_gateway_config_connection = ApiGatewayConfigConnectionOperations(
+ 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
@@ -470,6 +658,12 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize
)
self.policy_fragment = PolicyFragmentOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.policy_restriction = PolicyRestrictionOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.policy_restriction_validations = PolicyRestrictionValidationsOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.portal_config = PortalConfigOperations(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)
@@ -490,6 +684,10 @@ def __init__(
self.product_policy = ProductPolicyOperations(self._client, self._config, self._serialize, self._deserialize)
self.product_wiki = ProductWikiOperations(self._client, self._config, self._serialize, self._deserialize)
self.product_wikis = ProductWikisOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.product_api_link = ProductApiLinkOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.product_group_link = ProductGroupLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.quota_by_counter_keys = QuotaByCounterKeysOperations(
self._client, self._config, self._serialize, self._deserialize
)
@@ -505,6 +703,11 @@ def __init__(
)
self.subscription = SubscriptionOperations(self._client, self._config, self._serialize, self._deserialize)
self.tag_resource = TagResourceOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.tag_api_link = TagApiLinkOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.tag_operation_link = TagOperationLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.tag_product_link = TagProductLinkOperations(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
@@ -521,7 +724,109 @@ def __init__(
self.user_confirmation_password = UserConfirmationPasswordOperations(
self._client, self._config, self._serialize, self._deserialize
)
- self.documentation = DocumentationOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.workspace_backend = WorkspaceBackendOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_certificate = WorkspaceCertificateOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_diagnostic = WorkspaceDiagnosticOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_diagnostic = WorkspaceApiDiagnosticOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.api_management_workspace_links = ApiManagementWorkspaceLinksOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.api_management_workspace_link = ApiManagementWorkspaceLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_logger = WorkspaceLoggerOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace = WorkspaceOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.workspace_policy = WorkspacePolicyOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_named_value = WorkspaceNamedValueOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_global_schema = WorkspaceGlobalSchemaOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_notification = WorkspaceNotificationOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_notification_recipient_user = WorkspaceNotificationRecipientUserOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_notification_recipient_email = WorkspaceNotificationRecipientEmailOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_policy_fragment = WorkspacePolicyFragmentOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_group = WorkspaceGroupOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.workspace_group_user = WorkspaceGroupUserOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_subscription = WorkspaceSubscriptionOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_version_set = WorkspaceApiVersionSetOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api = WorkspaceApiOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.workspace_api_revision = WorkspaceApiRevisionOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_release = WorkspaceApiReleaseOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_operation = WorkspaceApiOperationOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_operation_policy = WorkspaceApiOperationPolicyOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_policy = WorkspaceApiPolicyOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_schema = WorkspaceApiSchemaOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_product = WorkspaceProductOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_product_api_link = WorkspaceProductApiLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_product_group_link = WorkspaceProductGroupLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_product_policy = WorkspaceProductPolicyOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_tag = WorkspaceTagOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.workspace_tag_api_link = WorkspaceTagApiLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_tag_operation_link = WorkspaceTagOperationLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_tag_product_link = WorkspaceTagProductLinkOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.workspace_api_export = WorkspaceApiExportOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.operation_status = OperationStatusOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.operations_results = OperationsResultsOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
def _send_request(
self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
@@ -550,7 +855,7 @@ def _send_request(
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "ApiManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
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 6649dde49846..28a9d6a80625 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
@@ -26,15 +26,15 @@ class ApiManagementClientConfiguration: # pylint: disable=too-many-instance-att
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
- :param subscription_id: The ID of the target subscription. Required.
+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
- :keyword api_version: Api Version. Default value is "2022-08-01". Note that overriding this
- default value may result in unsupported behavior.
+ :keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding
+ this default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- api_version: str = kwargs.pop("api_version", "2022-08-01")
+ api_version: str = kwargs.pop("api_version", "2024-06-01-preview")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
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
index f99e77fef986..17dbc073e01b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_patch.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_patch.py
@@ -25,6 +25,7 @@
#
# --------------------------------------------------------------------------
+
# 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():
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_vendor.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_vendor.py
index 36e30ba45094..6e3ccfbebf59 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_vendor.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_vendor.py
@@ -8,8 +8,6 @@
from abc import ABC
from typing import TYPE_CHECKING
-from azure.core.pipeline.transport import HttpRequest
-
from ._configuration import ApiManagementClientConfiguration
if TYPE_CHECKING:
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 b22d1486cf46..97018e014ea7 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
@@ -6,6 +6,9 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from ._api_gateway_operations import ApiGatewayOperations
+from ._api_management_gateway_skus_operations import ApiManagementGatewaySkusOperations
+from ._all_policies_operations import AllPoliciesOperations
from ._api_operations import ApiOperations
from ._api_revision_operations import ApiRevisionOperations
from ._api_release_operations import ApiReleaseOperations
@@ -27,11 +30,11 @@
from ._api_wikis_operations import ApiWikisOperations
from ._api_export_operations import ApiExportOperations
from ._api_version_set_operations import ApiVersionSetOperations
-from ._authorization_server_operations import AuthorizationServerOperations
from ._authorization_provider_operations import AuthorizationProviderOperations
from ._authorization_operations import AuthorizationOperations
from ._authorization_login_links_operations import AuthorizationLoginLinksOperations
from ._authorization_access_policy_operations import AuthorizationAccessPolicyOperations
+from ._authorization_server_operations import AuthorizationServerOperations
from ._backend_operations import BackendOperations
from ._cache_operations import CacheOperations
from ._certificate_operations import CertificateOperations
@@ -43,7 +46,9 @@
from ._api_management_service_skus_operations import ApiManagementServiceSkusOperations
from ._api_management_service_operations import ApiManagementServiceOperations
from ._diagnostic_operations import DiagnosticOperations
+from ._documentation_operations import DocumentationOperations
from ._email_template_operations import EmailTemplateOperations
+from ._api_gateway_config_connection_operations import ApiGatewayConfigConnectionOperations
from ._gateway_operations import GatewayOperations
from ._gateway_hostname_configuration_operations import GatewayHostnameConfigurationOperations
from ._gateway_api_operations import GatewayApiOperations
@@ -63,6 +68,8 @@
from ._policy_operations import PolicyOperations
from ._policy_description_operations import PolicyDescriptionOperations
from ._policy_fragment_operations import PolicyFragmentOperations
+from ._policy_restriction_operations import PolicyRestrictionOperations
+from ._policy_restriction_validations_operations import PolicyRestrictionValidationsOperations
from ._portal_config_operations import PortalConfigOperations
from ._portal_revision_operations import PortalRevisionOperations
from ._portal_settings_operations import PortalSettingsOperations
@@ -77,6 +84,8 @@
from ._product_policy_operations import ProductPolicyOperations
from ._product_wiki_operations import ProductWikiOperations
from ._product_wikis_operations import ProductWikisOperations
+from ._product_api_link_operations import ProductApiLinkOperations
+from ._product_group_link_operations import ProductGroupLinkOperations
from ._quota_by_counter_keys_operations import QuotaByCounterKeysOperations
from ._quota_by_period_keys_operations import QuotaByPeriodKeysOperations
from ._region_operations import RegionOperations
@@ -86,6 +95,9 @@
from ._api_management_skus_operations import ApiManagementSkusOperations
from ._subscription_operations import SubscriptionOperations
from ._tag_resource_operations import TagResourceOperations
+from ._tag_api_link_operations import TagApiLinkOperations
+from ._tag_operation_link_operations import TagOperationLinkOperations
+from ._tag_product_link_operations import TagProductLinkOperations
from ._tenant_access_operations import TenantAccessOperations
from ._tenant_access_git_operations import TenantAccessGitOperations
from ._tenant_configuration_operations import TenantConfigurationOperations
@@ -94,13 +106,52 @@
from ._user_subscription_operations import UserSubscriptionOperations
from ._user_identities_operations import UserIdentitiesOperations
from ._user_confirmation_password_operations import UserConfirmationPasswordOperations
-from ._documentation_operations import DocumentationOperations
+from ._workspace_backend_operations import WorkspaceBackendOperations
+from ._workspace_certificate_operations import WorkspaceCertificateOperations
+from ._workspace_diagnostic_operations import WorkspaceDiagnosticOperations
+from ._workspace_api_diagnostic_operations import WorkspaceApiDiagnosticOperations
+from ._api_management_workspace_links_operations import ApiManagementWorkspaceLinksOperations
+from ._api_management_workspace_link_operations import ApiManagementWorkspaceLinkOperations
+from ._workspace_logger_operations import WorkspaceLoggerOperations
+from ._workspace_operations import WorkspaceOperations
+from ._workspace_policy_operations import WorkspacePolicyOperations
+from ._workspace_named_value_operations import WorkspaceNamedValueOperations
+from ._workspace_global_schema_operations import WorkspaceGlobalSchemaOperations
+from ._workspace_notification_operations import WorkspaceNotificationOperations
+from ._workspace_notification_recipient_user_operations import WorkspaceNotificationRecipientUserOperations
+from ._workspace_notification_recipient_email_operations import WorkspaceNotificationRecipientEmailOperations
+from ._workspace_policy_fragment_operations import WorkspacePolicyFragmentOperations
+from ._workspace_group_operations import WorkspaceGroupOperations
+from ._workspace_group_user_operations import WorkspaceGroupUserOperations
+from ._workspace_subscription_operations import WorkspaceSubscriptionOperations
+from ._workspace_api_version_set_operations import WorkspaceApiVersionSetOperations
+from ._workspace_api_operations import WorkspaceApiOperations
+from ._workspace_api_revision_operations import WorkspaceApiRevisionOperations
+from ._workspace_api_release_operations import WorkspaceApiReleaseOperations
+from ._workspace_api_operation_operations import WorkspaceApiOperationOperations
+from ._workspace_api_operation_policy_operations import WorkspaceApiOperationPolicyOperations
+from ._workspace_api_policy_operations import WorkspaceApiPolicyOperations
+from ._workspace_api_schema_operations import WorkspaceApiSchemaOperations
+from ._workspace_product_operations import WorkspaceProductOperations
+from ._workspace_product_api_link_operations import WorkspaceProductApiLinkOperations
+from ._workspace_product_group_link_operations import WorkspaceProductGroupLinkOperations
+from ._workspace_product_policy_operations import WorkspaceProductPolicyOperations
+from ._workspace_tag_operations import WorkspaceTagOperations
+from ._workspace_tag_api_link_operations import WorkspaceTagApiLinkOperations
+from ._workspace_tag_operation_link_operations import WorkspaceTagOperationLinkOperations
+from ._workspace_tag_product_link_operations import WorkspaceTagProductLinkOperations
+from ._workspace_api_export_operations import WorkspaceApiExportOperations
+from ._operation_status_operations import OperationStatusOperations
+from ._operations_results_operations import OperationsResultsOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
+ "ApiGatewayOperations",
+ "ApiManagementGatewaySkusOperations",
+ "AllPoliciesOperations",
"ApiOperations",
"ApiRevisionOperations",
"ApiReleaseOperations",
@@ -122,11 +173,11 @@
"ApiWikisOperations",
"ApiExportOperations",
"ApiVersionSetOperations",
- "AuthorizationServerOperations",
"AuthorizationProviderOperations",
"AuthorizationOperations",
"AuthorizationLoginLinksOperations",
"AuthorizationAccessPolicyOperations",
+ "AuthorizationServerOperations",
"BackendOperations",
"CacheOperations",
"CertificateOperations",
@@ -138,7 +189,9 @@
"ApiManagementServiceSkusOperations",
"ApiManagementServiceOperations",
"DiagnosticOperations",
+ "DocumentationOperations",
"EmailTemplateOperations",
+ "ApiGatewayConfigConnectionOperations",
"GatewayOperations",
"GatewayHostnameConfigurationOperations",
"GatewayApiOperations",
@@ -158,6 +211,8 @@
"PolicyOperations",
"PolicyDescriptionOperations",
"PolicyFragmentOperations",
+ "PolicyRestrictionOperations",
+ "PolicyRestrictionValidationsOperations",
"PortalConfigOperations",
"PortalRevisionOperations",
"PortalSettingsOperations",
@@ -172,6 +227,8 @@
"ProductPolicyOperations",
"ProductWikiOperations",
"ProductWikisOperations",
+ "ProductApiLinkOperations",
+ "ProductGroupLinkOperations",
"QuotaByCounterKeysOperations",
"QuotaByPeriodKeysOperations",
"RegionOperations",
@@ -181,6 +238,9 @@
"ApiManagementSkusOperations",
"SubscriptionOperations",
"TagResourceOperations",
+ "TagApiLinkOperations",
+ "TagOperationLinkOperations",
+ "TagProductLinkOperations",
"TenantAccessOperations",
"TenantAccessGitOperations",
"TenantConfigurationOperations",
@@ -189,7 +249,43 @@
"UserSubscriptionOperations",
"UserIdentitiesOperations",
"UserConfirmationPasswordOperations",
- "DocumentationOperations",
+ "WorkspaceBackendOperations",
+ "WorkspaceCertificateOperations",
+ "WorkspaceDiagnosticOperations",
+ "WorkspaceApiDiagnosticOperations",
+ "ApiManagementWorkspaceLinksOperations",
+ "ApiManagementWorkspaceLinkOperations",
+ "WorkspaceLoggerOperations",
+ "WorkspaceOperations",
+ "WorkspacePolicyOperations",
+ "WorkspaceNamedValueOperations",
+ "WorkspaceGlobalSchemaOperations",
+ "WorkspaceNotificationOperations",
+ "WorkspaceNotificationRecipientUserOperations",
+ "WorkspaceNotificationRecipientEmailOperations",
+ "WorkspacePolicyFragmentOperations",
+ "WorkspaceGroupOperations",
+ "WorkspaceGroupUserOperations",
+ "WorkspaceSubscriptionOperations",
+ "WorkspaceApiVersionSetOperations",
+ "WorkspaceApiOperations",
+ "WorkspaceApiRevisionOperations",
+ "WorkspaceApiReleaseOperations",
+ "WorkspaceApiOperationOperations",
+ "WorkspaceApiOperationPolicyOperations",
+ "WorkspaceApiPolicyOperations",
+ "WorkspaceApiSchemaOperations",
+ "WorkspaceProductOperations",
+ "WorkspaceProductApiLinkOperations",
+ "WorkspaceProductGroupLinkOperations",
+ "WorkspaceProductPolicyOperations",
+ "WorkspaceTagOperations",
+ "WorkspaceTagApiLinkOperations",
+ "WorkspaceTagOperationLinkOperations",
+ "WorkspaceTagProductLinkOperations",
+ "WorkspaceApiExportOperations",
+ "OperationStatusOperations",
+ "OperationsResultsOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_all_policies_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_all_policies_operations.py
new file mode 100644
index 000000000000..033fc6bf49ea
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_all_policies_operations.py
@@ -0,0 +1,141 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._all_policies_operations import build_list_by_service_request
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class AllPoliciesOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`all_policies` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> AsyncIterable["_models.AllPoliciesContract"]:
+ """Status of all policies of API Management services.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :return: An iterator like instance of either AllPoliciesContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.AllPoliciesContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.AllPoliciesCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("AllPoliciesCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
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 a7ef0d45eb39..435e0083c605 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -37,8 +36,11 @@
build_list_by_service_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -103,7 +105,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DiagnosticCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -126,7 +128,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -142,7 +143,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -193,7 +193,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -217,7 +217,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -260,7 +259,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -284,7 +283,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -302,7 +300,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DiagnosticContract", pipeline_response)
+ deserialized = self._deserialize("DiagnosticContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -421,7 +419,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -458,7 +456,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -474,15 +471,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DiagnosticContract", pipeline_response)
+ deserialized = self._deserialize("DiagnosticContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -601,7 +592,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -638,7 +629,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -656,7 +646,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DiagnosticContract", pipeline_response)
+ deserialized = self._deserialize("DiagnosticContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -687,7 +677,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -712,7 +702,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 deca47cc566c..879c07433fe9 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar, Union
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,17 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -73,8 +75,8 @@ async def get(
instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required.
:type api_id: str
:param format: Format in which to export the Api Details to the Storage Blob with Sas Key valid
- for 5 minutes. Known values are: "swagger-link", "wsdl-link", "wadl-link", "openapi-link", and
- "openapi+json-link". Required.
+ for 5 minutes. New formats can be added in the future. Known values are: "swagger-link",
+ "wsdl-link", "wadl-link", "openapi-link", and "openapi+json-link". Required.
:type format: str or ~azure.mgmt.apimanagement.models.ExportFormat
:param export: Query parameter required to export the API details. "true" Required.
:type export: str or ~azure.mgmt.apimanagement.models.ExportApi
@@ -82,7 +84,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.ApiExportResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -107,7 +109,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -122,7 +123,7 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiExportResult", pipeline_response)
+ deserialized = self._deserialize("ApiExportResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_gateway_config_connection_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_gateway_config_connection_operations.py
new file mode 100644
index 000000000000..3299da38cecb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_gateway_config_connection_operations.py
@@ -0,0 +1,560 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
+
+from ... import models as _models
+from ...operations._api_gateway_config_connection_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_gateway_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class ApiGatewayConfigConnectionOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`api_gateway_config_connection` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_gateway(
+ self, resource_group_name: str, gateway_name: str, **kwargs: Any
+ ) -> AsyncIterable["_models.ApiManagementGatewayConfigConnectionResource"]:
+ """List all API Management gateway config connections within a gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :return: An iterator like instance of either ApiManagementGatewayConfigConnectionResource or
+ the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementGatewayConfigConnectionListResult] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_gateway_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiManagementGatewayConfigConnectionListResult", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, gateway_name: str, config_connection_name: str, **kwargs: Any
+ ) -> _models.ApiManagementGatewayConfigConnectionResource:
+ """Gets an API Management gateway config connection resource description.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param config_connection_name: The name of the API Management gateway config connection.
+ Required.
+ :type config_connection_name: str
+ :return: ApiManagementGatewayConfigConnectionResource or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementGatewayConfigConnectionResource] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ config_connection_name=config_connection_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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(
+ "ApiManagementGatewayConfigConnectionResource", pipeline_response.http_response
+ )
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ async def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ config_connection_name: str,
+ parameters: Union[_models.ApiManagementGatewayConfigConnectionResource, IO[bytes]],
+ **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiManagementGatewayConfigConnectionResource")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ config_connection_name=config_connection_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ config_connection_name: str,
+ parameters: _models.ApiManagementGatewayConfigConnectionResource,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiManagementGatewayConfigConnectionResource]:
+ """Creates or updates an API Management gateway config connection. This is long running operation
+ and could take several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param config_connection_name: The name of the API Management gateway config connection.
+ Required.
+ :type config_connection_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway config
+ connection operation. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of AsyncLROPoller that returns either
+ ApiManagementGatewayConfigConnectionResource or the result of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ config_connection_name: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiManagementGatewayConfigConnectionResource]:
+ """Creates or updates an API Management gateway config connection. This is long running operation
+ and could take several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param config_connection_name: The name of the API Management gateway config connection.
+ Required.
+ :type config_connection_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway config
+ connection operation. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of AsyncLROPoller that returns either
+ ApiManagementGatewayConfigConnectionResource or the result of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ config_connection_name: str,
+ parameters: Union[_models.ApiManagementGatewayConfigConnectionResource, IO[bytes]],
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiManagementGatewayConfigConnectionResource]:
+ """Creates or updates an API Management gateway config connection. This is long running operation
+ and could take several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param config_connection_name: The name of the API Management gateway config connection.
+ Required.
+ :type config_connection_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway config
+ connection operation. Is either a ApiManagementGatewayConfigConnectionResource type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource
+ or IO[bytes]
+ :return: An instance of AsyncLROPoller that returns either
+ ApiManagementGatewayConfigConnectionResource or the result of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiManagementGatewayConfigConnectionResource] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ config_connection_name=config_connection_name,
+ parameters=parameters,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ deserialized = self._deserialize(
+ "ApiManagementGatewayConfigConnectionResource", pipeline_response.http_response
+ )
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(
+ AsyncPollingMethod,
+ AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs),
+ )
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[_models.ApiManagementGatewayConfigConnectionResource].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[_models.ApiManagementGatewayConfigConnectionResource](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ async def _delete_initial(
+ self, resource_group_name: str, gateway_name: str, config_connection_name: str, if_match: str, **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ config_connection_name=config_connection_name,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def begin_delete(
+ self, resource_group_name: str, gateway_name: str, config_connection_name: str, if_match: str, **kwargs: Any
+ ) -> AsyncLROPoller[None]:
+ """Deletes an existing API Management gateway config connection.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param config_connection_name: The name of the API Management gateway config connection.
+ Required.
+ :type config_connection_name: 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. Required.
+ :type if_match: str
+ :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:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._delete_initial(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ config_connection_name=config_connection_name,
+ if_match=if_match,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[None].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_gateway_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_gateway_operations.py
new file mode 100644
index 000000000000..5cdc908f2140
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_gateway_operations.py
@@ -0,0 +1,809 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
+
+from ... import models as _models
+from ...operations._api_gateway_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_resource_group_request,
+ build_list_request,
+ build_update_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class ApiGatewayOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`api_gateway` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ async def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: Union[_models.ApiManagementGatewayResource, IO[bytes]],
+ **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiManagementGatewayResource")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: _models.ApiManagementGatewayResource,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiManagementGatewayResource]:
+ """Creates or updates an API Management gateway. This is long running operation and could take
+ several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway operation.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementGatewayResource
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of AsyncLROPoller that returns either ApiManagementGatewayResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiManagementGatewayResource]:
+ """Creates or updates an API Management gateway. This is long running operation and could take
+ several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway operation.
+ Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of AsyncLROPoller that returns either ApiManagementGatewayResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: Union[_models.ApiManagementGatewayResource, IO[bytes]],
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiManagementGatewayResource]:
+ """Creates or updates an API Management gateway. This is long running operation and could take
+ several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway operation.
+ Is either a ApiManagementGatewayResource type or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementGatewayResource or IO[bytes]
+ :return: An instance of AsyncLROPoller that returns either ApiManagementGatewayResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiManagementGatewayResource] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ parameters=parameters,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ deserialized = self._deserialize("ApiManagementGatewayResource", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[_models.ApiManagementGatewayResource].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[_models.ApiManagementGatewayResource](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ async def _update_initial(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: Union[_models.ApiManagementGatewayUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiManagementGatewayUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def begin_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: _models.ApiManagementGatewayUpdateParameters,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiManagementGatewayResource]:
+ """Updates an existing API Management gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway operation.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementGatewayUpdateParameters
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of AsyncLROPoller that returns either ApiManagementGatewayResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def begin_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiManagementGatewayResource]:
+ """Updates an existing API Management gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway operation.
+ Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of AsyncLROPoller that returns either ApiManagementGatewayResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def begin_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: Union[_models.ApiManagementGatewayUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiManagementGatewayResource]:
+ """Updates an existing API Management gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway operation.
+ Is either a ApiManagementGatewayUpdateParameters type or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementGatewayUpdateParameters or
+ IO[bytes]
+ :return: An instance of AsyncLROPoller that returns either ApiManagementGatewayResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiManagementGatewayResource] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._update_initial(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ parameters=parameters,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ deserialized = self._deserialize("ApiManagementGatewayResource", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[_models.ApiManagementGatewayResource].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[_models.ApiManagementGatewayResource](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, gateway_name: str, **kwargs: Any
+ ) -> _models.ApiManagementGatewayResource:
+ """Gets an API Management gateway resource description.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :return: ApiManagementGatewayResource or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiManagementGatewayResource
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementGatewayResource] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiManagementGatewayResource", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ async def _delete_initial(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def begin_delete(
+ self, resource_group_name: str, gateway_name: str, **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiManagementGatewayResource]:
+ """Deletes an existing API Management gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :return: An instance of AsyncLROPoller that returns either ApiManagementGatewayResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementGatewayResource] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._delete_initial(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ response_headers = {}
+ response = pipeline_response.http_response
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = self._deserialize("ApiManagementGatewayResource", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[_models.ApiManagementGatewayResource].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[_models.ApiManagementGatewayResource](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ @distributed_trace
+ def list_by_resource_group(
+ self, resource_group_name: str, **kwargs: Any
+ ) -> AsyncIterable["_models.ApiManagementGatewayResource"]:
+ """List all API Management gateways within a resource group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :return: An iterator like instance of either ApiManagementGatewayResource or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementGatewayListResult] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_resource_group_request(
+ resource_group_name=resource_group_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiManagementGatewayListResult", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def list(self, **kwargs: Any) -> AsyncIterable["_models.ApiManagementGatewayResource"]:
+ """List all API Management gateways within a subscription.
+
+ :return: An iterator like instance of either ApiManagementGatewayResource or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementGatewayListResult] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_request(
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiManagementGatewayListResult", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
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 3e24b20f9db4..98888f8587af 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -36,8 +35,11 @@
build_get_request,
build_list_by_service_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -108,7 +110,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.IssueAttachmentCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -132,7 +134,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -148,7 +149,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -203,7 +203,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -228,7 +228,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -274,7 +273,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.IssueAttachmentContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -299,7 +298,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -317,7 +315,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueAttachmentContract", pipeline_response)
+ deserialized = self._deserialize("IssueAttachmentContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -448,7 +446,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.IssueAttachmentContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -486,7 +484,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -502,15 +499,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueAttachmentContract", pipeline_response)
+ deserialized = self._deserialize("IssueAttachmentContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -551,7 +542,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -577,7 +568,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 aeea6c77fcae..5472c59c8e3b 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -36,8 +35,11 @@
build_get_request,
build_list_by_service_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -108,7 +110,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.IssueCommentCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -132,7 +134,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -148,7 +149,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -203,7 +203,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -228,7 +228,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -274,7 +273,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.IssueCommentContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -299,7 +298,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -317,7 +315,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueCommentContract", pipeline_response)
+ deserialized = self._deserialize("IssueCommentContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -448,7 +446,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.IssueCommentContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -486,7 +484,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -502,15 +499,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueCommentContract", pipeline_response)
+ deserialized = self._deserialize("IssueCommentContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -551,7 +542,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -577,7 +568,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 f1443090a530..1ab9ebf41555 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -37,8 +36,11 @@
build_list_by_service_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -106,7 +108,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.IssueCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -130,7 +132,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -146,7 +147,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -197,7 +197,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -221,7 +221,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -272,7 +271,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.IssueContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -297,7 +296,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -315,7 +313,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueContract", pipeline_response)
+ deserialized = self._deserialize("IssueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -434,7 +432,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.IssueContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -471,7 +469,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -487,15 +484,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueContract", pipeline_response)
+ deserialized = self._deserialize("IssueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -614,7 +605,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.IssueContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -651,7 +642,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -669,7 +659,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueContract", pipeline_response)
+ deserialized = self._deserialize("IssueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -700,7 +690,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -725,7 +715,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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
index 80276e2d9d75..e92b1a65581f 100644
--- 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,35 +16,40 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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
from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ApiManagementClientOperationsMixin(ApiManagementClientMixinABC):
+
async def _perform_connectivity_check_async_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
service_name: str,
connectivity_check_request_params: Union[_models.ConnectivityCheckRequest, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.ConnectivityCheckResponse]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -56,7 +62,7 @@ async def _perform_connectivity_check_async_initial( # pylint: disable=name-too
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.ConnectivityCheckResponse]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -77,10 +83,10 @@ async def _perform_connectivity_check_async_initial( # pylint: disable=name-too
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -88,16 +94,22 @@ async def _perform_connectivity_check_async_initial( # pylint: disable=name-too
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
- if response.status_code == 200:
- deserialized = self._deserialize("ConnectivityCheckResponse", pipeline_response)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@@ -209,10 +221,11 @@ async def begin_perform_connectivity_check_async(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ConnectivityCheckResponse", pipeline_response)
+ deserialized = self._deserialize("ConnectivityCheckResponse", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_gateway_skus_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_gateway_skus_operations.py
new file mode 100644
index 000000000000..fbe48275168d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_gateway_skus_operations.py
@@ -0,0 +1,144 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._api_management_gateway_skus_operations import build_list_available_skus_request
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class ApiManagementGatewaySkusOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`api_management_gateway_skus` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_available_skus(
+ self, resource_group_name: str, gateway_name: str, **kwargs: Any
+ ) -> AsyncIterable["_models.GatewayResourceSkuResult"]:
+ """Gets available SKUs for API Management gateway.
+
+ Gets all available SKU for a given API Management gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :return: An iterator like instance of either GatewayResourceSkuResult or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GatewayResourceSkuResult]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.GatewayResourceSkuResults] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_available_skus_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("GatewayResourceSkuResults", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
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 ecc6845d5d2f..bd297ffe7d64 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,17 +20,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -67,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -83,7 +85,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -99,7 +100,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 eb084d2c6305..e80d64ce648e 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +32,6 @@
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,
build_backup_request,
@@ -46,8 +47,11 @@
build_restore_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -77,8 +81,8 @@ async def _restore_initial(
service_name: str,
parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.ApiManagementServiceResource]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -91,7 +95,7 @@ async def _restore_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -112,10 +116,10 @@ async def _restore_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -123,18 +127,20 @@ async def _restore_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
-
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -253,10 +259,11 @@ async def begin_restore(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -286,8 +293,8 @@ async def _backup_initial(
service_name: str,
parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.ApiManagementServiceResource]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,7 +307,7 @@ async def _backup_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -321,10 +328,10 @@ async def _backup_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -332,17 +339,19 @@ async def _backup_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
-
if response.status_code == 202:
- response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -456,10 +465,11 @@ async def begin_backup(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -489,8 +499,8 @@ async def _create_or_update_initial(
service_name: str,
parameters: Union[_models.ApiManagementServiceResource, IO[bytes]],
**kwargs: Any
- ) -> _models.ApiManagementServiceResource:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -503,7 +513,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -524,10 +534,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -535,15 +545,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 response.status_code == 200:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -658,10 +668,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -689,8 +700,8 @@ async def _update_initial(
service_name: str,
parameters: Union[_models.ApiManagementServiceUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.ApiManagementServiceResource]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -703,7 +714,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -724,10 +735,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -735,16 +746,22 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
- if response.status_code == 200:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@@ -854,10 +871,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -894,7 +912,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -916,7 +934,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -931,17 +948,15 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- async def _delete_initial(
- self, resource_group_name: str, service_name: str, **kwargs: Any
- ) -> Optional[_models.ApiManagementServiceResource]:
- error_map = {
+ async def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -953,7 +968,7 @@ async def _delete_initial(
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -963,10 +978,10 @@ async def _delete_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -974,16 +989,22 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
+ response_headers = {}
if response.status_code == 202:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@@ -1022,12 +1043,17 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ response_headers = {}
+ response = pipeline_response.http_response
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
if polling is True:
@@ -1048,9 +1074,13 @@ def get_long_running_output(pipeline_response):
)
async def _migrate_to_stv2_initial(
- self, resource_group_name: str, service_name: str, **kwargs: Any
- ) -> Optional[_models.ApiManagementServiceResource]:
- error_map = {
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[Union[_models.MigrateToStv2Contract, IO[bytes]]] = None,
+ **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1058,24 +1088,39 @@ async def _migrate_to_stv2_initial(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None)
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ if parameters is not None:
+ _json = self._serialize.body(parameters, "MigrateToStv2Contract")
+ else:
+ _json = None
_request = build_migrate_to_stv2_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -1083,26 +1128,94 @@ async def _migrate_to_stv2_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
-
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
+ @overload
+ async def begin_migrate_to_stv2(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[_models.MigrateToStv2Contract] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiManagementServiceResource]:
+ """Upgrades an API Management service to the Stv2 platform. For details refer to
+ https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation
+ and could take several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param parameters: Optional parameters supplied to migrate service. Default value is None.
+ :type parameters: ~azure.mgmt.apimanagement.models.MigrateToStv2Contract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @overload
+ async def begin_migrate_to_stv2(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiManagementServiceResource]:
+ """Upgrades an API Management service to the Stv2 platform. For details refer to
+ https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation
+ and could take several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param parameters: Optional parameters supplied to migrate service. Default value is None.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
@distributed_trace_async
async def begin_migrate_to_stv2(
- self, resource_group_name: str, service_name: str, **kwargs: Any
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[Union[_models.MigrateToStv2Contract, IO[bytes]]] = None,
+ **kwargs: Any
) -> AsyncLROPoller[_models.ApiManagementServiceResource]:
"""Upgrades an API Management service to the Stv2 platform. For details refer to
https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation
@@ -1113,16 +1226,20 @@ async def begin_migrate_to_stv2(
:type resource_group_name: str
:param service_name: The name of the API Management service. Required.
:type service_name: str
+ :param parameters: Optional parameters supplied to migrate service. Is either a
+ MigrateToStv2Contract type or a IO[bytes] type. Default value is None.
+ :type parameters: ~azure.mgmt.apimanagement.models.MigrateToStv2Contract or IO[bytes]
: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:
"""
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
@@ -1131,16 +1248,19 @@ async def begin_migrate_to_stv2(
raw_result = await self._migrate_to_stv2_initial(
resource_group_name=resource_group_name,
service_name=service_name,
+ parameters=parameters,
api_version=api_version,
+ content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -1185,7 +1305,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiManagementServiceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1203,7 +1323,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1219,7 +1338,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1265,7 +1383,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ApiManagementServiceReso
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiManagementServiceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1282,7 +1400,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1298,7 +1415,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1343,7 +1459,7 @@ async def get_sso_token(
:rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceGetSsoTokenResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1365,7 +1481,6 @@ async def get_sso_token(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1380,7 +1495,7 @@ async def get_sso_token(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiManagementServiceGetSsoTokenResult", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceGetSsoTokenResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1439,7 +1554,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1471,7 +1586,6 @@ async def check_name_availability(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1486,7 +1600,7 @@ async def check_name_availability(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiManagementServiceNameAvailabilityResult", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceNameAvailabilityResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1503,7 +1617,7 @@ async def get_domain_ownership_identifier(
:rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceGetDomainOwnershipIdentifierResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1523,7 +1637,6 @@ async def get_domain_ownership_identifier(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1538,7 +1651,9 @@ async def get_domain_ownership_identifier(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiManagementServiceGetDomainOwnershipIdentifierResult", pipeline_response)
+ deserialized = self._deserialize(
+ "ApiManagementServiceGetDomainOwnershipIdentifierResult", pipeline_response.http_response
+ )
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1551,8 +1666,8 @@ async def _apply_network_configuration_updates_initial( # pylint: disable=name-
service_name: str,
parameters: Optional[Union[_models.ApiManagementServiceApplyNetworkConfigurationParameters, IO[bytes]]] = None,
**kwargs: Any
- ) -> Optional[_models.ApiManagementServiceResource]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1565,7 +1680,7 @@ async def _apply_network_configuration_updates_initial( # pylint: disable=name-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -1589,10 +1704,10 @@ async def _apply_network_configuration_updates_initial( # pylint: disable=name-
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -1600,18 +1715,20 @@ async def _apply_network_configuration_updates_initial( # pylint: disable=name-
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
-
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1733,10 +1850,11 @@ async def begin_apply_network_configuration_updates( # pylint: disable=name-too
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
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 ff56c9c5e1b8..8a552f1920b0 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,17 +20,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -77,7 +79,7 @@ def list_available_service_skus(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ResourceSkuResults] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -96,7 +98,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -112,7 +113,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 aa5e770d4073..957ffc762b9c 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,17 +20,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -68,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ApiManagementSku"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiManagementSkusResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -85,7 +87,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -101,7 +102,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_workspace_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_workspace_link_operations.py
new file mode 100644
index 000000000000..7956524dcfe1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_workspace_link_operations.py
@@ -0,0 +1,116 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._api_management_workspace_link_operations import build_get_request
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class ApiManagementWorkspaceLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`api_management_workspace_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, **kwargs: Any
+ ) -> _models.ApiManagementWorkspaceLinksResource:
+ """Gets an API Management WorkspaceLink resource description.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :return: ApiManagementWorkspaceLinksResource or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiManagementWorkspaceLinksResource
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementWorkspaceLinksResource] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiManagementWorkspaceLinksResource", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_workspace_links_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_workspace_links_operations.py
new file mode 100644
index 000000000000..1a99f2e1539f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_workspace_links_operations.py
@@ -0,0 +1,142 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._api_management_workspace_links_operations import build_list_by_service_request
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class ApiManagementWorkspaceLinksOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`api_management_workspace_links` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> AsyncIterable["_models.ApiManagementWorkspaceLinksResource"]:
+ """List all API Management workspaceLinks for a service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :return: An iterator like instance of either ApiManagementWorkspaceLinksResource or the result
+ of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiManagementWorkspaceLinksResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementWorkspaceLinksListResult] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiManagementWorkspaceLinksListResult", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
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 8c28e203c901..a159ad72d386 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -37,8 +36,11 @@
build_list_by_api_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -110,7 +112,7 @@ def list_by_api(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -134,7 +136,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -150,7 +151,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -201,7 +201,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -225,7 +225,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -268,7 +267,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.OperationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -292,7 +291,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -310,7 +308,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("OperationContract", pipeline_response)
+ deserialized = self._deserialize("OperationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -429,7 +427,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.OperationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -466,7 +464,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -482,15 +479,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("OperationContract", pipeline_response)
+ deserialized = self._deserialize("OperationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -609,7 +600,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.OperationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -646,7 +637,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -664,7 +654,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("OperationContract", pipeline_response)
+ deserialized = self._deserialize("OperationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -695,7 +685,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -720,7 +710,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 ccaab7636299..47ecdccdf17a 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,14 +19,12 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -33,8 +32,11 @@
build_get_request,
build_list_by_operation_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -79,7 +81,7 @@ async def list_by_operation(
:rtype: ~azure.mgmt.apimanagement.models.PolicyCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,7 +105,6 @@ async def list_by_operation(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -118,7 +119,7 @@ async def list_by_operation(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PolicyCollection", pipeline_response)
+ deserialized = self._deserialize("PolicyCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -154,7 +155,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -179,7 +180,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -234,7 +234,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -260,7 +260,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -278,7 +277,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -406,7 +405,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -444,7 +443,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -460,15 +458,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -508,7 +500,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -534,7 +526,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 3ef0a274184d..dea7452fe3b9 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +32,6 @@
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,
build_delete_request,
@@ -40,8 +41,11 @@
build_list_by_tags_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -115,7 +119,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -139,7 +143,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -155,7 +158,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -201,7 +203,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, api_
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -224,7 +226,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, api_
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -262,7 +263,7 @@ async def get(self, resource_group_name: str, service_name: str, api_id: str, **
:rtype: ~azure.mgmt.apimanagement.models.ApiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -285,7 +286,6 @@ async def get(self, resource_group_name: str, service_name: str, api_id: str, **
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -303,7 +303,7 @@ async def get(self, resource_group_name: str, service_name: str, api_id: str, **
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiContract", pipeline_response)
+ deserialized = self._deserialize("ApiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -318,8 +318,8 @@ async def _create_or_update_initial(
parameters: Union[_models.ApiCreateOrUpdateParameter, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.ApiContract]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -332,7 +332,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.ApiContract]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -355,32 +355,33 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = 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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("ApiContract", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -513,14 +514,19 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("ApiContract", pipeline_response)
+ deserialized = self._deserialize("ApiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
@@ -644,7 +650,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.ApiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -680,7 +686,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -698,15 +703,14 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiContract", pipeline_response)
+ deserialized = self._deserialize("ApiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
- @distributed_trace_async
- async def delete( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
service_name: str,
@@ -714,27 +718,8 @@ async def delete( # pylint: disable=inconsistent-return-statements
if_match: str,
delete_revisions: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- """Deletes the specified API of the API Management service instance.
-
- :param resource_group_name: The name of the resource group. The name is case insensitive.
- Required.
- :type resource_group_name: str
- :param service_name: The name of the API Management service. Required.
- :type service_name: str
- :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. Required.
- :type api_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. Required.
- :type if_match: str
- :param delete_revisions: Delete all revisions of the Api. Default value is None.
- :type delete_revisions: bool
- :return: None or the result of cls(response)
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
- """
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -746,7 +731,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -759,23 +744,112 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [200, 204]:
+ if response.status_code not in [202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def begin_delete(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ api_id: str,
+ if_match: str,
+ delete_revisions: Optional[bool] = None,
+ **kwargs: Any
+ ) -> AsyncLROPoller[None]:
+ """Deletes the specified API of the API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :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. Required.
+ :type api_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. Required.
+ :type if_match: str
+ :param delete_revisions: Delete all revisions of the Api. Default value is None.
+ :type delete_revisions: bool
+ :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:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._delete_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ api_id=api_id,
+ if_match=if_match,
+ delete_revisions=delete_revisions,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(
+ AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[None].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list_by_tags(
@@ -823,7 +897,7 @@ def list_by_tags(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -846,7 +920,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -862,7 +935,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 7dd4eb436f2a..67f7a1d276ed 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,14 +19,12 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -33,8 +32,11 @@
build_get_request,
build_list_by_api_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -76,7 +78,7 @@ async def list_by_api(
:rtype: ~azure.mgmt.apimanagement.models.PolicyCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -99,7 +101,6 @@ async def list_by_api(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -114,7 +115,7 @@ async def list_by_api(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PolicyCollection", pipeline_response)
+ deserialized = self._deserialize("PolicyCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -146,7 +147,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -170,7 +171,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -221,7 +221,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -246,7 +246,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -262,15 +261,9 @@ async def get(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -386,7 +379,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -423,7 +416,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -439,15 +431,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -483,7 +469,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -508,7 +494,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 9bac8262d0d4..f29234b27a1a 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,17 +20,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -94,7 +96,7 @@ def list_by_apis(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ProductCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -117,7 +119,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -133,7 +134,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 fc1b729d416d..8479877e3b74 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -37,8 +36,11 @@
build_list_by_service_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -105,7 +107,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiReleaseCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -128,7 +130,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -144,7 +145,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -195,7 +195,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -219,7 +219,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -262,7 +261,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -286,7 +285,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -304,7 +302,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiReleaseContract", pipeline_response)
+ deserialized = self._deserialize("ApiReleaseContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -423,7 +421,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -460,7 +458,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -476,15 +473,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiReleaseContract", pipeline_response)
+ deserialized = self._deserialize("ApiReleaseContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -603,7 +594,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -640,7 +631,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -658,7 +648,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiReleaseContract", pipeline_response)
+ deserialized = self._deserialize("ApiReleaseContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -689,7 +679,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -714,7 +704,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 dcf50132e204..7b3ff280087e 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,17 +20,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -94,7 +96,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiRevisionCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -117,7 +119,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -133,7 +134,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 782a6061539b..23ebfd6c9074 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +32,6 @@
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,
build_delete_request,
@@ -38,8 +39,11 @@
build_get_request,
build_list_by_api_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -104,7 +108,7 @@ def list_by_api(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SchemaCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -127,7 +131,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -143,7 +146,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -194,7 +196,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -218,7 +220,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -261,7 +262,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.SchemaContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -285,7 +286,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -303,7 +303,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("SchemaContract", pipeline_response)
+ deserialized = self._deserialize("SchemaContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -319,8 +319,8 @@ async def _create_or_update_initial(
parameters: Union[_models.SchemaContract, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.SchemaContract]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -333,7 +333,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.SchemaContract]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -357,32 +357,33 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = 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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("SchemaContract", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -528,14 +529,19 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("SchemaContract", pipeline_response)
+ deserialized = self._deserialize("SchemaContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
@@ -593,7 +599,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -619,7 +625,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 eca451c070c7..1a11e3226bc5 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -36,8 +35,11 @@
build_get_request,
build_list_by_service_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -105,7 +107,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagDescriptionCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -128,7 +130,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -144,7 +145,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -195,7 +195,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -219,7 +219,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -262,7 +261,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.TagDescriptionContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -286,7 +285,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -304,7 +302,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagDescriptionContract", pipeline_response)
+ deserialized = self._deserialize("TagDescriptionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -423,7 +421,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.TagDescriptionContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -460,7 +458,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -476,15 +473,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagDescriptionContract", pipeline_response)
+ deserialized = self._deserialize("TagDescriptionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -521,7 +512,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -546,7 +537,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 96169927d64f..f71384e8a6c3 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -37,8 +36,11 @@
build_list_by_service_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -99,7 +101,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiVersionSetCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -121,7 +123,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -137,7 +138,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -185,7 +185,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -208,7 +208,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -248,7 +247,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -271,7 +270,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -289,7 +287,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiVersionSetContract", pipeline_response)
+ deserialized = self._deserialize("ApiVersionSetContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -396,7 +394,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -432,7 +430,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -448,15 +445,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiVersionSetContract", pipeline_response)
+ deserialized = self._deserialize("ApiVersionSetContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -563,7 +554,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -599,7 +590,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -617,7 +607,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiVersionSetContract", pipeline_response)
+ deserialized = self._deserialize("ApiVersionSetContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -645,7 +635,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -669,7 +659,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wiki_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wiki_operations.py
index 43bc87ba9a75..aa9bc5006114 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wiki_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wiki_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,14 +19,12 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._api_wiki_operations import (
build_create_or_update_request,
build_delete_request,
@@ -33,8 +32,11 @@
build_get_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -74,7 +76,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, api_
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -97,7 +99,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, api_
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -137,7 +138,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.WikiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -160,7 +161,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -178,7 +178,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("WikiContract", pipeline_response)
+ deserialized = self._deserialize("WikiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -285,7 +285,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.WikiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -321,7 +321,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -337,15 +336,9 @@ async def create_or_update(
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("WikiContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("WikiContract", pipeline_response)
+ deserialized = self._deserialize("WikiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -452,7 +445,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.WikiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -488,7 +481,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -506,7 +498,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("WikiContract", pipeline_response)
+ deserialized = self._deserialize("WikiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -534,7 +526,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -558,7 +550,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wikis_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wikis_operations.py
index 7f810130fc5c..652a9496eb74 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wikis_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wikis_operations.py
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,17 +20,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._api_wikis_operations import build_list_request
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -92,7 +94,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WikiCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -115,7 +117,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -131,7 +132,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_access_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_access_policy_operations.py
index e8bf6cabba8e..497807991b75 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_access_policy_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_access_policy_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,23 +21,24 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._authorization_access_policy_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_by_authorization_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -105,7 +107,7 @@ def list_by_authorization(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AuthorizationAccessPolicyCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -129,7 +131,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -145,7 +146,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -202,7 +202,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -227,7 +227,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -245,7 +244,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -368,7 +367,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -406,7 +405,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -422,15 +420,9 @@ async def create_or_update(
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("AuthorizationAccessPolicyContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -468,7 +460,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -494,7 +486,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_login_links_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_login_links_operations.py
index c923aa35aaf4..a897f5202873 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_login_links_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_login_links_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,17 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._authorization_login_links_operations import build_post_request
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -147,7 +149,7 @@ async def post(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationLoginResponseContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -183,7 +185,6 @@ async def post(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -201,7 +202,7 @@ async def post(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationLoginResponseContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationLoginResponseContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_operations.py
index 918b0be6666e..125aacee140b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._authorization_operations import (
build_confirm_consent_code_request,
build_create_or_update_request,
@@ -36,8 +35,11 @@
build_get_request,
build_list_by_authorization_provider_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -103,7 +105,7 @@ def list_by_authorization_provider(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AuthorizationCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -126,7 +128,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -142,7 +143,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -196,7 +196,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -220,7 +220,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -238,7 +237,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -351,7 +350,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -388,7 +387,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -404,15 +402,9 @@ async def create_or_update(
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("AuthorizationContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -447,7 +439,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -472,7 +464,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -586,7 +577,7 @@ async def confirm_consent_code( # pylint: disable=inconsistent-return-statement
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -622,7 +613,6 @@ async def confirm_consent_code( # pylint: disable=inconsistent-return-statement
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_provider_operations.py
index a62b4a0d731e..53eb129fc696 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_provider_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_provider_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,23 +21,24 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._authorization_provider_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_by_service_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -99,7 +101,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AuthorizationProviderCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -121,7 +123,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -137,7 +138,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -184,7 +184,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -207,7 +207,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -225,7 +224,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -329,7 +328,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -365,7 +364,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -381,15 +379,9 @@ async def create_or_update(
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("AuthorizationProviderContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -416,7 +408,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -440,7 +432,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 8f992607cc7c..38dba1b40b4f 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -38,8 +37,11 @@
build_list_secrets_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -102,7 +104,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AuthorizationServerCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -124,7 +126,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -140,7 +141,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -185,7 +185,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, auth
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -208,7 +208,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, auth
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -247,7 +246,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -270,7 +269,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -288,7 +286,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationServerContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationServerContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -392,7 +390,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -428,7 +426,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -444,15 +441,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationServerContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationServerContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -557,7 +548,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -593,7 +584,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -611,7 +601,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationServerContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationServerContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -638,7 +628,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -662,7 +652,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -697,7 +686,7 @@ async def list_secrets(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerSecretsContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -720,7 +709,6 @@ async def list_secrets(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -738,7 +726,7 @@ async def list_secrets(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationServerSecretsContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationServerSecretsContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # 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 8400c1866d51..d3f12146e726 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -38,8 +37,11 @@
build_reconnect_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -102,7 +104,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.BackendCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -124,7 +126,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -140,7 +141,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -186,7 +186,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, back
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -209,7 +209,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, back
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -249,7 +248,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.BackendContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -272,7 +271,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -290,7 +288,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("BackendContract", pipeline_response)
+ deserialized = self._deserialize("BackendContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -397,7 +395,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.BackendContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -433,7 +431,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -449,15 +446,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("BackendContract", pipeline_response)
+ deserialized = self._deserialize("BackendContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -564,7 +555,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.BackendContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -600,7 +591,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -618,7 +608,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("BackendContract", pipeline_response)
+ deserialized = self._deserialize("BackendContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -646,7 +636,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -670,7 +660,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -779,7 +768,7 @@ async def reconnect( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -817,7 +806,6 @@ async def reconnect( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 38f9f19324b7..0fe872f62d15 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -37,8 +36,11 @@
build_list_by_service_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -92,7 +94,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CacheCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -113,7 +115,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -129,7 +130,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -175,7 +175,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, cach
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -198,7 +198,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, cach
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -238,7 +237,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.CacheContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -261,7 +260,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -279,7 +277,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("CacheContract", pipeline_response)
+ deserialized = self._deserialize("CacheContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -395,7 +393,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.CacheContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -431,7 +429,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -447,15 +444,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("CacheContract", pipeline_response)
+ deserialized = self._deserialize("CacheContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -562,7 +553,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.CacheContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -598,7 +589,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -616,7 +606,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("CacheContract", pipeline_response)
+ deserialized = self._deserialize("CacheContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -644,7 +634,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -668,7 +658,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 afc6d711f935..a04a750fcc55 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -37,8 +36,11 @@
build_list_by_service_request,
build_refresh_secret_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -105,7 +107,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CertificateCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -128,7 +130,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -144,7 +145,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -192,7 +192,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -215,7 +215,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -255,7 +254,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.CertificateContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -278,7 +277,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -296,7 +294,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("CertificateContract", pipeline_response)
+ deserialized = self._deserialize("CertificateContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -416,7 +414,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.CertificateContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -452,7 +450,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -468,15 +465,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("CertificateContract", pipeline_response)
+ deserialized = self._deserialize("CertificateContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -504,7 +495,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -528,7 +519,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -568,7 +558,7 @@ async def refresh_secret(
:rtype: ~azure.mgmt.apimanagement.models.CertificateContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -591,7 +581,6 @@ async def refresh_secret(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -609,7 +598,7 @@ async def refresh_secret(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("CertificateContract", pipeline_response)
+ deserialized = self._deserialize("CertificateContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # 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 5fa69b548a9a..5e18d4c1fce5 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -36,8 +35,11 @@
build_get_request,
build_list_by_service_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -85,7 +87,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ContentItemCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -105,7 +107,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -121,7 +122,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -171,7 +171,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -195,7 +195,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -236,7 +235,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.ContentItemContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -260,7 +259,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -278,7 +276,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ContentItemContract", pipeline_response)
+ deserialized = self._deserialize("ContentItemContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -391,7 +389,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ContentItemContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -428,7 +426,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -444,15 +441,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ContentItemContract", pipeline_response)
+ deserialized = self._deserialize("ContentItemContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -487,7 +478,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -512,7 +503,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 555f8ae358f1..e22797896620 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,23 +21,24 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -83,7 +85,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ContentTypeCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -102,7 +104,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -118,7 +119,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -166,7 +166,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.ContentTypeContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -189,7 +189,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -207,7 +206,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ContentTypeContract", pipeline_response)
+ deserialized = self._deserialize("ContentTypeContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -317,7 +316,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ContentTypeContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -353,7 +352,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -369,15 +367,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ContentTypeContract", pipeline_response)
+ deserialized = self._deserialize("ContentTypeContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -406,7 +398,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -430,7 +422,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 118980ca6af7..2915738aa15d 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,14 +19,12 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -33,8 +32,11 @@
build_list_secrets_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -71,7 +73,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -93,7 +95,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -128,7 +129,7 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any)
:rtype: ~azure.mgmt.apimanagement.models.PortalDelegationSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -150,7 +151,6 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any)
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -168,7 +168,7 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any)
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PortalDelegationSettings", pipeline_response)
+ deserialized = self._deserialize("PortalDelegationSettings", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -263,7 +263,7 @@ async def update( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -298,7 +298,6 @@ async def update( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -404,7 +403,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PortalDelegationSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -439,7 +438,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -454,7 +452,7 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PortalDelegationSettings", pipeline_response)
+ deserialized = self._deserialize("PortalDelegationSettings", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -476,7 +474,7 @@ async def list_secrets(
:rtype: ~azure.mgmt.apimanagement.models.PortalSettingValidationKeyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -498,7 +496,6 @@ async def list_secrets(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -513,7 +510,7 @@ async def list_secrets(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PortalSettingValidationKeyContract", pipeline_response)
+ deserialized = self._deserialize("PortalSettingValidationKeyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 f142e9a597ee..19eca60208d8 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -16,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -29,14 +31,16 @@
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,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -76,7 +80,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DeletedS
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DeletedServicesCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -93,7 +97,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -109,7 +112,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -151,7 +153,7 @@ async def get_by_name(self, service_name: str, location: str, **kwargs: Any) ->
:rtype: ~azure.mgmt.apimanagement.models.DeletedServiceContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -173,7 +175,6 @@ async def get_by_name(self, service_name: str, location: str, **kwargs: Any) ->
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -188,17 +189,15 @@ async def get_by_name(self, service_name: str, location: str, **kwargs: Any) ->
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeletedServiceContract", pipeline_response)
+ deserialized = self._deserialize("DeletedServiceContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- async def _purge_initial(
- self, service_name: str, location: str, **kwargs: Any
- ) -> Optional[_models.DeletedServiceContract]:
- error_map = {
+ async def _purge_initial(self, service_name: str, location: str, **kwargs: Any) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -210,7 +209,7 @@ async def _purge_initial(
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[Optional[_models.DeletedServiceContract]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_purge_request(
service_name=service_name,
@@ -220,10 +219,10 @@ async def _purge_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -231,16 +230,19 @@ async def _purge_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
response_headers = {}
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
- deserialized = self._deserialize("DeletedServiceContract", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -281,6 +283,7 @@ async def begin_purge(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
@@ -288,7 +291,7 @@ def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
- deserialized = self._deserialize("DeletedServiceContract", pipeline_response)
+ deserialized = self._deserialize("DeletedServiceContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
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 b92f0d1a114c..ea92f868bf2f 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -37,8 +36,11 @@
build_list_by_service_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -99,7 +101,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DiagnosticCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -121,7 +123,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -137,7 +138,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -185,7 +185,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -208,7 +208,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -248,7 +247,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -271,7 +270,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -289,7 +287,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DiagnosticContract", pipeline_response)
+ deserialized = self._deserialize("DiagnosticContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -396,7 +394,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -432,7 +430,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -448,15 +445,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DiagnosticContract", pipeline_response)
+ deserialized = self._deserialize("DiagnosticContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -563,7 +554,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -599,7 +590,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -617,7 +607,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DiagnosticContract", pipeline_response)
+ deserialized = self._deserialize("DiagnosticContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -645,7 +635,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -669,7 +659,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_documentation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_documentation_operations.py
index 6041eadfd5d0..4fa61a26842f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_documentation_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_documentation_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._documentation_operations import (
build_create_or_update_request,
build_delete_request,
@@ -37,8 +36,11 @@
build_list_by_service_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -99,7 +101,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DocumentationCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -121,7 +123,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -137,7 +138,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -185,7 +185,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -208,7 +208,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -248,7 +247,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.DocumentationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -271,7 +270,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -289,7 +287,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DocumentationContract", pipeline_response)
+ deserialized = self._deserialize("DocumentationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -396,7 +394,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.DocumentationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -432,7 +430,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -448,15 +445,9 @@ async def create_or_update(
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("DocumentationContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DocumentationContract", pipeline_response)
+ deserialized = self._deserialize("DocumentationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -563,7 +554,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.DocumentationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -599,7 +590,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -617,7 +607,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DocumentationContract", pipeline_response)
+ deserialized = self._deserialize("DocumentationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -645,7 +635,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -669,7 +659,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 5afa030b8d0e..868dfe57f7cc 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -37,8 +36,11 @@
build_list_by_service_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -100,7 +102,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EmailTemplateCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -122,7 +124,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -138,7 +139,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -196,7 +196,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -219,7 +219,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -269,7 +268,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -292,7 +291,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -310,7 +308,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("EmailTemplateContract", pipeline_response)
+ deserialized = self._deserialize("EmailTemplateContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -435,7 +433,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -471,7 +469,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -486,11 +483,7 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("EmailTemplateContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EmailTemplateContract", pipeline_response)
+ deserialized = self._deserialize("EmailTemplateContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -615,7 +608,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -651,7 +644,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -669,7 +661,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("EmailTemplateContract", pipeline_response)
+ deserialized = self._deserialize("EmailTemplateContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -708,7 +700,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -732,7 +724,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 44ac6852140b..5fb39674022e 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,23 +21,24 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -100,7 +102,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -123,7 +125,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -139,7 +140,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -190,7 +190,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -214,7 +214,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -336,7 +335,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ApiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -375,7 +374,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -390,11 +388,7 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("ApiContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ApiContract", pipeline_response)
+ deserialized = self._deserialize("ApiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -422,7 +416,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -446,7 +440,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 0a4aab7cd7f8..36de7ace5d65 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -36,8 +35,11 @@
build_get_request,
build_list_by_service_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -102,7 +104,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GatewayCertificateAuthorityCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -125,7 +127,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -141,7 +142,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -192,7 +192,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -216,7 +216,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -259,7 +258,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -283,7 +282,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -301,7 +299,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayCertificateAuthorityContract", pipeline_response)
+ deserialized = self._deserialize("GatewayCertificateAuthorityContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -421,7 +419,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -458,7 +456,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -474,15 +471,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayCertificateAuthorityContract", pipeline_response)
+ deserialized = self._deserialize("GatewayCertificateAuthorityContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -519,7 +510,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -544,7 +535,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 02dbddaafcec..0a37e52ea810 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -36,8 +35,11 @@
build_get_request,
build_list_by_service_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -104,7 +106,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GatewayHostnameConfigurationCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -127,7 +129,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -143,7 +144,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -195,7 +195,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -219,7 +219,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -262,7 +261,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -286,7 +285,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -304,7 +302,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayHostnameConfigurationContract", pipeline_response)
+ deserialized = self._deserialize("GatewayHostnameConfigurationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -424,7 +422,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -461,7 +459,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -477,15 +474,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayHostnameConfigurationContract", pipeline_response)
+ deserialized = self._deserialize("GatewayHostnameConfigurationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -516,7 +507,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -541,7 +532,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 c17451ca21cd..00bdcd8cc2c6 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,28 +21,32 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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_invalidate_debug_credentials_request,
build_list_by_service_request,
+ build_list_debug_credentials_request,
build_list_keys_request,
+ build_list_trace_request,
build_regenerate_key_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -104,7 +109,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GatewayCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -126,7 +131,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -142,7 +146,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -188,7 +191,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, gate
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -211,7 +214,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, gate
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -251,7 +253,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.GatewayContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -274,7 +276,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -292,7 +293,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayContract", pipeline_response)
+ deserialized = self._deserialize("GatewayContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -398,7 +399,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.GatewayContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -434,7 +435,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -450,15 +450,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayContract", pipeline_response)
+ deserialized = self._deserialize("GatewayContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -564,7 +558,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.GatewayContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -600,7 +594,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -618,7 +611,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayContract", pipeline_response)
+ deserialized = self._deserialize("GatewayContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -646,7 +639,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -670,7 +663,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -706,7 +698,7 @@ async def list_keys(
:rtype: ~azure.mgmt.apimanagement.models.GatewayKeysContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -729,7 +721,6 @@ async def list_keys(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -747,7 +738,7 @@ async def list_keys(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayKeysContract", pipeline_response)
+ deserialized = self._deserialize("GatewayKeysContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -843,7 +834,7 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -878,7 +869,6 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -983,7 +973,7 @@ async def generate_token(
:rtype: ~azure.mgmt.apimanagement.models.GatewayTokenContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1018,7 +1008,6 @@ async def generate_token(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1033,7 +1022,354 @@ async def generate_token(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("GatewayTokenContract", pipeline_response)
+ deserialized = self._deserialize("GatewayTokenContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def invalidate_debug_credentials( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, gateway_id: str, **kwargs: Any
+ ) -> None:
+ """Action is invalidating all debug credentials issued for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_invalidate_debug_credentials_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ gateway_id=gateway_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+
+ @overload
+ async def list_debug_credentials(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: _models.GatewayListDebugCredentialsContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GatewayDebugCredentialsContract:
+ """Create new debug credentials for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List debug credentials properties. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListDebugCredentialsContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: GatewayDebugCredentialsContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GatewayDebugCredentialsContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def list_debug_credentials(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GatewayDebugCredentialsContract:
+ """Create new debug credentials for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List debug credentials properties. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: GatewayDebugCredentialsContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GatewayDebugCredentialsContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def list_debug_credentials(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: Union[_models.GatewayListDebugCredentialsContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.GatewayDebugCredentialsContract:
+ """Create new debug credentials for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List debug credentials properties. Is either a
+ GatewayListDebugCredentialsContract type or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListDebugCredentialsContract or
+ IO[bytes]
+ :return: GatewayDebugCredentialsContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GatewayDebugCredentialsContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.GatewayDebugCredentialsContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GatewayListDebugCredentialsContract")
+
+ _request = build_list_debug_credentials_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ gateway_id=gateway_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("GatewayDebugCredentialsContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def list_trace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: _models.GatewayListTraceContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Dict[str, Any]:
+ """Fetches trace collected by gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List trace properties. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListTraceContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: dict mapping str to any or the result of cls(response)
+ :rtype: dict[str, any]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def list_trace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Dict[str, Any]:
+ """Fetches trace collected by gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List trace properties. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: dict mapping str to any or the result of cls(response)
+ :rtype: dict[str, any]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def list_trace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: Union[_models.GatewayListTraceContract, IO[bytes]],
+ **kwargs: Any
+ ) -> Dict[str, Any]:
+ """Fetches trace collected by gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List trace properties. Is either a GatewayListTraceContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListTraceContract or IO[bytes]
+ :return: dict mapping str to any or the result of cls(response)
+ :rtype: dict[str, any]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[Dict[str, Any]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GatewayListTraceContract")
+
+ _request = build_list_trace_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ gateway_id=gateway_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("{object}", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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
index a3de1118cb3e..1b6bd47cc6ec 100644
--- 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +32,6 @@
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,
build_delete_request,
@@ -38,8 +39,11 @@
build_get_request,
build_list_by_service_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -101,7 +105,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GlobalSchemaCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -123,7 +127,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -139,7 +142,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -185,7 +187,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sche
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -208,7 +210,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sche
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -248,7 +249,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.GlobalSchemaContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -271,7 +272,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -289,7 +289,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -304,8 +304,8 @@ async def _create_or_update_initial(
parameters: Union[_models.GlobalSchemaContract, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.GlobalSchemaContract]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -318,7 +318,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.GlobalSchemaContract]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -341,32 +341,33 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = 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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -502,14 +503,19 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
@@ -554,7 +560,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -578,7 +584,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_operations.py
index 555b58801e64..8b212f1a35ce 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._graph_ql_api_resolver_operations import (
build_create_or_update_request,
build_delete_request,
@@ -37,8 +36,11 @@
build_list_by_api_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -106,7 +108,7 @@ def list_by_api(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ResolverCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -129,7 +131,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -145,7 +146,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -196,7 +196,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -220,7 +220,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -263,7 +262,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.ResolverContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -287,7 +286,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -305,7 +303,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ResolverContract", pipeline_response)
+ deserialized = self._deserialize("ResolverContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -424,7 +422,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ResolverContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -461,7 +459,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -477,15 +474,9 @@ async def create_or_update(
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("ResolverContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ResolverContract", pipeline_response)
+ deserialized = self._deserialize("ResolverContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -604,7 +595,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.ResolverContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -641,7 +632,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -659,7 +649,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ResolverContract", pipeline_response)
+ deserialized = self._deserialize("ResolverContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -690,7 +680,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -715,7 +705,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_policy_operations.py
index 62c4dce33e88..0bc241c8f293 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_policy_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_policy_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._graph_ql_api_resolver_policy_operations import (
build_create_or_update_request,
build_delete_request,
@@ -36,8 +35,11 @@
build_get_request,
build_list_by_resolver_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -89,7 +91,7 @@ def list_by_resolver(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -110,7 +112,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -126,7 +127,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -186,7 +186,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -211,7 +211,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -266,7 +265,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -292,7 +291,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -310,7 +308,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -438,7 +436,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -476,7 +474,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -492,15 +489,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -540,7 +531,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -566,7 +557,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 66fe9a062bc9..5eb97bdb58ec 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -37,8 +36,11 @@
build_list_by_service_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -103,7 +105,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GroupCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -125,7 +127,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -141,7 +142,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -187,7 +187,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, grou
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -210,7 +210,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, grou
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -250,7 +249,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.GroupContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -273,7 +272,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -291,7 +289,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GroupContract", pipeline_response)
+ deserialized = self._deserialize("GroupContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -398,7 +396,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.GroupContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -434,7 +432,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -450,15 +447,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GroupContract", pipeline_response)
+ deserialized = self._deserialize("GroupContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -565,7 +556,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.GroupContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -601,7 +592,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -619,7 +609,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GroupContract", pipeline_response)
+ deserialized = self._deserialize("GroupContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -647,7 +637,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -671,7 +661,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 e76b8629c58d..56504d72706b 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,23 +20,24 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -103,7 +105,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.UserCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -126,7 +128,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -142,7 +143,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -193,7 +193,7 @@ async def check_entity_exists(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -217,7 +217,6 @@ async def check_entity_exists(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -257,7 +256,7 @@ async def create(
:rtype: ~azure.mgmt.apimanagement.models.UserContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -281,7 +280,6 @@ async def create(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -296,11 +294,7 @@ async def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("UserContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("UserContract", pipeline_response)
+ deserialized = self._deserialize("UserContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -328,7 +322,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -352,7 +346,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 8124d13b6033..cbcb502a794d 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -38,8 +37,11 @@
build_list_secrets_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -90,7 +92,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.IdentityProviderList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -109,7 +111,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -125,7 +126,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -177,7 +177,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -200,7 +200,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -245,7 +244,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -268,7 +267,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -286,7 +284,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IdentityProviderContract", pipeline_response)
+ deserialized = self._deserialize("IdentityProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -393,7 +391,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -429,7 +427,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -445,15 +442,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IdentityProviderContract", pipeline_response)
+ deserialized = self._deserialize("IdentityProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -561,7 +552,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -597,7 +588,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -615,7 +605,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IdentityProviderContract", pipeline_response)
+ deserialized = self._deserialize("IdentityProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -648,7 +638,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -672,7 +662,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -712,7 +701,7 @@ async def list_secrets(
:rtype: ~azure.mgmt.apimanagement.models.ClientSecretContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -735,7 +724,6 @@ async def list_secrets(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -753,7 +741,7 @@ async def list_secrets(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ClientSecretContract", pipeline_response)
+ deserialized = self._deserialize("ClientSecretContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # 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 7c44f282deeb..066a5bc205de 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,18 +20,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -94,7 +96,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.IssueCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -116,7 +118,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -132,7 +133,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -180,7 +180,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.IssueContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -203,7 +203,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -221,7 +220,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueContract", pipeline_response)
+ deserialized = self._deserialize("IssueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # 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 1b0664de5d3e..1158e7f6836c 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -37,8 +36,11 @@
build_list_by_service_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -104,7 +106,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.LoggerCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -126,7 +128,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -142,7 +143,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -188,7 +188,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, logg
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -211,7 +211,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, logg
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -251,7 +250,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.LoggerContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -274,7 +273,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -292,7 +290,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("LoggerContract", pipeline_response)
+ deserialized = self._deserialize("LoggerContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -399,7 +397,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.LoggerContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -435,7 +433,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -451,15 +448,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("LoggerContract", pipeline_response)
+ deserialized = self._deserialize("LoggerContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -566,7 +557,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.LoggerContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -602,7 +593,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -620,7 +610,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("LoggerContract", pipeline_response)
+ deserialized = self._deserialize("LoggerContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -648,7 +638,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -672,7 +662,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 3e912822bda3..86fd8b0effb4 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +32,6 @@
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,
build_delete_request,
@@ -41,8 +42,11 @@
build_refresh_secret_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -111,7 +115,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.NamedValueCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -134,7 +138,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -150,7 +153,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -197,7 +199,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -220,7 +222,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -259,7 +260,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.NamedValueContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -282,7 +283,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -300,7 +300,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ deserialized = self._deserialize("NamedValueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -315,8 +315,8 @@ async def _create_or_update_initial(
parameters: Union[_models.NamedValueCreateContract, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.NamedValueContract]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -329,7 +329,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -352,32 +352,33 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = 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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -507,14 +508,19 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ deserialized = self._deserialize("NamedValueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
@@ -546,8 +552,8 @@ async def _update_initial(
if_match: str,
parameters: Union[_models.NamedValueUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.NamedValueContract]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -560,7 +566,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -583,10 +589,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -594,16 +600,25 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = 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 == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -733,6 +748,7 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
@@ -740,7 +756,7 @@ def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ deserialized = self._deserialize("NamedValueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
@@ -784,7 +800,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -808,7 +824,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -843,7 +858,7 @@ async def list_value(
:rtype: ~azure.mgmt.apimanagement.models.NamedValueSecretContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -866,7 +881,6 @@ async def list_value(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -884,7 +898,7 @@ async def list_value(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("NamedValueSecretContract", pipeline_response)
+ deserialized = self._deserialize("NamedValueSecretContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -893,8 +907,8 @@ async def list_value(
async def _refresh_secret_initial(
self, resource_group_name: str, service_name: str, named_value_id: str, **kwargs: Any
- ) -> Optional[_models.NamedValueContract]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -906,7 +920,7 @@ async def _refresh_secret_initial(
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_refresh_secret_request(
resource_group_name=resource_group_name,
@@ -917,10 +931,10 @@ async def _refresh_secret_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -928,16 +942,25 @@ async def _refresh_secret_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = 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 == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -981,6 +1004,7 @@ async def begin_refresh_secret(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
@@ -988,7 +1012,7 @@ def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ deserialized = self._deserialize("NamedValueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
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 f38a7f53653a..840be779a3fe 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, List, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, List, Optional, Type, TypeVar
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,17 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -68,7 +70,7 @@ async def list_by_service(
:rtype: list[~azure.mgmt.apimanagement.models.NetworkStatusContractByLocation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -90,7 +92,6 @@ async def list_by_service(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -105,7 +106,7 @@ async def list_by_service(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("[NetworkStatusContractByLocation]", pipeline_response)
+ deserialized = self._deserialize("[NetworkStatusContractByLocation]", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -132,7 +133,7 @@ async def list_by_location(
:rtype: ~azure.mgmt.apimanagement.models.NetworkStatusContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -155,7 +156,6 @@ async def list_by_location(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -170,7 +170,7 @@ async def list_by_location(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NetworkStatusContract", pipeline_response)
+ deserialized = self._deserialize("NetworkStatusContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 32518cdedc6a..b64760c7a48f 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,22 +20,23 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -90,7 +92,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.NotificationCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -111,7 +113,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -127,7 +128,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -181,7 +181,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.NotificationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -204,7 +204,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -219,7 +218,7 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NotificationContract", pipeline_response)
+ deserialized = self._deserialize("NotificationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -254,7 +253,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.NotificationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -278,7 +277,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -293,7 +291,7 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NotificationContract", pipeline_response)
+ deserialized = self._deserialize("NotificationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 9525272c57b7..0ff51c008e5c 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar, Union
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,22 +18,23 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -80,7 +82,7 @@ async def list_by_notification(
:rtype: ~azure.mgmt.apimanagement.models.RecipientEmailCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,7 +105,6 @@ async def list_by_notification(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -118,7 +119,7 @@ async def list_by_notification(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RecipientEmailCollection", pipeline_response)
+ deserialized = self._deserialize("RecipientEmailCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -152,7 +153,7 @@ async def check_entity_exists(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -176,7 +177,6 @@ async def check_entity_exists(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -222,7 +222,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.RecipientEmailContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -246,7 +246,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -261,11 +260,7 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("RecipientEmailContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("RecipientEmailContract", pipeline_response)
+ deserialized = self._deserialize("RecipientEmailContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -299,7 +294,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -323,7 +318,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 6e3db7b28d5c..dec28c4e67e4 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar, Union
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,22 +18,23 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -80,7 +82,7 @@ async def list_by_notification(
:rtype: ~azure.mgmt.apimanagement.models.RecipientUserCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,7 +105,6 @@ async def list_by_notification(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -118,7 +119,7 @@ async def list_by_notification(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RecipientUserCollection", pipeline_response)
+ deserialized = self._deserialize("RecipientUserCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -153,7 +154,7 @@ async def check_entity_exists(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -177,7 +178,6 @@ async def check_entity_exists(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -224,7 +224,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.RecipientUserContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -248,7 +248,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -263,11 +262,7 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("RecipientUserContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("RecipientUserContract", pipeline_response)
+ deserialized = self._deserialize("RecipientUserContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -302,7 +297,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -326,7 +321,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 581718936e7f..e7099cd17bab 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -38,8 +37,11 @@
build_list_secrets_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -102,7 +104,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OpenIdConnectProviderCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -124,7 +126,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -140,7 +141,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -185,7 +185,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, opid
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -208,7 +208,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, opid
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -247,7 +246,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -270,7 +269,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -288,7 +286,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response)
+ deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -392,7 +390,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -428,7 +426,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -444,15 +441,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response)
+ deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -557,7 +548,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -593,7 +584,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -611,7 +601,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response)
+ deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -638,7 +628,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -662,7 +652,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -697,7 +686,7 @@ async def list_secrets(
:rtype: ~azure.mgmt.apimanagement.models.ClientSecretContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -720,7 +709,6 @@ async def list_secrets(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -738,7 +726,7 @@ async def list_secrets(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ClientSecretContract", pipeline_response)
+ deserialized = self._deserialize("ClientSecretContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # 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 8d098e3e845b..c06e0c529c74 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,17 +20,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -102,7 +104,7 @@ def list_by_tags(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -126,7 +128,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -142,7 +143,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_operation_status_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_operation_status_operations.py
new file mode 100644
index 000000000000..74b2dad86a57
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_operation_status_operations.py
@@ -0,0 +1,109 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._operation_status_operations import build_get_request
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class OperationStatusOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`operation_status` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace_async
+ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.OperationStatusResult:
+ """Returns the current status of an async operation.
+
+ :param location: The name of the Azure region. Required.
+ :type location: str
+ :param operation_id: The ID of an ongoing async operation. Required.
+ :type operation_id: str
+ :return: OperationStatusResult or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationStatusResult
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ location=location,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("OperationStatusResult", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_operations_results_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_operations_results_operations.py
new file mode 100644
index 000000000000..0bab2ee63372
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_operations_results_operations.py
@@ -0,0 +1,112 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._operations_results_operations import build_get_request
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class OperationsResultsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`operations_results` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace_async
+ async def get( # pylint: disable=inconsistent-return-statements
+ self, location: str, operation_id: str, **kwargs: Any
+ ) -> None:
+ """Returns operation results for long running operations executing DELETE or PATCH on the
+ resource.
+
+ :param location: The name of the Azure region. Required.
+ :type location: str
+ :param operation_id: The ID of an ongoing async operation. Required.
+ :type operation_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ location=location,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers) # type: ignore
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
index d8b835cf8b2b..eb2d0534428a 100644
--- 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,17 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -66,7 +68,7 @@ async def list_by_service(
:rtype: ~azure.mgmt.apimanagement.models.OutboundEnvironmentEndpointList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -88,7 +90,6 @@ async def list_by_service(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -103,7 +104,7 @@ async def list_by_service(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OutboundEnvironmentEndpointList", pipeline_response)
+ deserialized = self._deserialize("OutboundEnvironmentEndpointList", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 14d5e699a480..7cc89e42e95a 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar, Union
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,17 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -73,7 +75,7 @@ async def list_by_service(
:rtype: ~azure.mgmt.apimanagement.models.PolicyDescriptionCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -96,7 +98,6 @@ async def list_by_service(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -111,7 +112,7 @@ async def list_by_service(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PolicyDescriptionCollection", pipeline_response)
+ deserialized = self._deserialize("PolicyDescriptionCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_fragment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_fragment_operations.py
index 7b333551dae6..7eeeb9852000 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_fragment_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_fragment_operations.py
@@ -7,27 +7,31 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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._policy_fragment_operations import (
build_create_or_update_request,
build_delete_request,
@@ -36,8 +40,11 @@
build_list_by_service_request,
build_list_references_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -61,8 +68,8 @@ def __init__(self, *args, **kwargs) -> None:
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
- @distributed_trace_async
- async def list_by_service(
+ @distributed_trace
+ def list_by_service(
self,
resource_group_name: str,
service_name: str,
@@ -71,7 +78,7 @@ async def list_by_service(
top: Optional[int] = None,
skip: Optional[int] = None,
**kwargs: Any
- ) -> _models.PolicyFragmentCollection:
+ ) -> AsyncIterable["_models.PolicyFragmentContract"]:
"""Gets all policy fragments.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -92,57 +99,84 @@ async def list_by_service(
:type top: int
:param skip: Number of records to skip. Default value is None.
:type skip: int
- :return: PolicyFragmentCollection or the result of cls(response)
- :rtype: ~azure.mgmt.apimanagement.models.PolicyFragmentCollection
+ :return: An iterator like instance of either PolicyFragmentContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.PolicyFragmentContract]
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
- 401: ClientAuthenticationError,
- 404: ResourceNotFoundError,
- 409: ResourceExistsError,
- 304: ResourceNotModifiedError,
- }
- error_map.update(kwargs.pop("error_map", {}) or {})
-
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PolicyFragmentCollection] = kwargs.pop("cls", None)
- _request = build_list_by_service_request(
- resource_group_name=resource_group_name,
- service_name=service_name,
- subscription_id=self._config.subscription_id,
- filter=filter,
- orderby=orderby,
- top=top,
- skip=skip,
- api_version=api_version,
- headers=_headers,
- params=_params,
- )
- _request = _convert_request(_request)
- _request.url = self._client.format_url(_request.url)
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
- _stream = False
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- _request, stream=_stream, **kwargs
- )
+ 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,
+ orderby=orderby,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyFragmentCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
- response = pipeline_response.http_response
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
- if response.status_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)
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
- deserialized = self._deserialize("PolicyFragmentCollection", pipeline_response)
+ if response.status_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)
- if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return pipeline_response
- return deserialized # type: ignore
+ return AsyncItemPaged(get_next, extract_data)
@distributed_trace_async
async def get_entity_tag(self, resource_group_name: str, service_name: str, id: str, **kwargs: Any) -> bool:
@@ -159,7 +193,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, id:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -182,7 +216,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, id:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -229,7 +262,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.PolicyFragmentContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -253,7 +286,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -271,7 +303,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
+ deserialized = self._deserialize("PolicyFragmentContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -286,8 +318,8 @@ async def _create_or_update_initial(
parameters: Union[_models.PolicyFragmentContract, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.PolicyFragmentContract]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,7 +332,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PolicyFragmentContract]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -323,35 +355,33 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
response_headers = {}
- if response.status_code == 200:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
-
- deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
-
- deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- if response.status_code == 202:
- response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -484,14 +514,19 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
+ deserialized = self._deserialize("PolicyFragmentContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
@@ -535,7 +570,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -559,7 +594,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -604,7 +638,7 @@ async def list_references(
:rtype: ~azure.mgmt.apimanagement.models.ResourceCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -629,7 +663,6 @@ async def list_references(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -644,7 +677,7 @@ async def list_references(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ResourceCollection", pipeline_response)
+ deserialized = self._deserialize("ResourceCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 3577a75500f8..cf0d770e3650 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
@@ -7,8 +7,11 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
@@ -18,14 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -33,8 +35,11 @@
build_get_request,
build_list_by_service_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -58,10 +63,10 @@ def __init__(self, *args, **kwargs) -> None:
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
- @distributed_trace_async
- async def list_by_service(
+ @distributed_trace
+ def list_by_service(
self, resource_group_name: str, service_name: str, **kwargs: Any
- ) -> _models.PolicyCollection:
+ ) -> AsyncIterable["_models.PolicyContract"]:
"""Lists all the Global Policy definitions of the Api Management service.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -69,53 +74,79 @@ async def list_by_service(
:type resource_group_name: str
:param service_name: The name of the API Management service. Required.
:type service_name: str
- :return: PolicyCollection or the result of cls(response)
- :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection
+ :return: An iterator like instance of either PolicyContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.PolicyContract]
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
- 401: ClientAuthenticationError,
- 404: ResourceNotFoundError,
- 409: ResourceExistsError,
- 304: ResourceNotModifiedError,
- }
- error_map.update(kwargs.pop("error_map", {}) or {})
-
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None)
- _request = build_list_by_service_request(
- resource_group_name=resource_group_name,
- service_name=service_name,
- subscription_id=self._config.subscription_id,
- api_version=api_version,
- headers=_headers,
- params=_params,
- )
- _request = _convert_request(_request)
- _request.url = self._client.format_url(_request.url)
-
- _stream = False
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- _request, stream=_stream, **kwargs
- )
-
- response = pipeline_response.http_response
-
- if response.status_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("PolicyCollection", pipeline_response)
-
- if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
- return deserialized # type: ignore
+ 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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
@distributed_trace_async
async def get_entity_tag(
@@ -135,7 +166,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -158,7 +189,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -205,7 +235,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -229,7 +259,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -247,7 +276,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -351,7 +380,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -387,7 +416,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -403,15 +431,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -443,7 +465,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -467,7 +489,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_restriction_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_restriction_operations.py
new file mode 100644
index 000000000000..cc2887466f35
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_restriction_operations.py
@@ -0,0 +1,656 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._policy_restriction_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,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class PolicyRestrictionOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`policy_restriction` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> AsyncIterable["_models.PolicyRestrictionContract"]:
+ """Gets all policy restrictions of API Management services.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :return: An iterator like instance of either PolicyRestrictionContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.PolicyRestrictionContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyRestrictionCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyRestrictionCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, policy_restriction_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the policy restriction in the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, policy_restriction_id: str, **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Get the policy restriction of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyRestrictionContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyRestrictionContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ parameters: _models.PolicyRestrictionContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Creates or updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Creates or updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ parameters: Union[_models.PolicyRestrictionContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Creates or updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param parameters: The policy restriction to apply. Is either a PolicyRestrictionContract type
+ or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.PolicyRestrictionContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyRestrictionContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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("PolicyRestrictionContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: str,
+ parameters: _models.PolicyRestrictionUpdateContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_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. Required.
+ :type if_match: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionUpdateContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_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. Required.
+ :type if_match: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: str,
+ parameters: Union[_models.PolicyRestrictionUpdateContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_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. Required.
+ :type if_match: str
+ :param parameters: The policy restriction to apply. Is either a PolicyRestrictionUpdateContract
+ type or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionUpdateContract or IO[bytes]
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.PolicyRestrictionContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyRestrictionUpdateContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyRestrictionContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the policy restriction configuration of the Api Management Service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_restriction_validations_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_restriction_validations_operations.py
new file mode 100644
index 000000000000..96f4ef9ab168
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_restriction_validations_operations.py
@@ -0,0 +1,176 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
+
+from ... import models as _models
+from ...operations._policy_restriction_validations_operations import build_by_service_request
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class PolicyRestrictionValidationsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`policy_restriction_validations` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ async def _by_service_initial(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ _request = build_by_service_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def begin_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> AsyncLROPoller[_models.OperationResultContract]:
+ """Validate all policies of API Management services.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :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:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.OperationResultContract] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._by_service_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ deserialized = self._deserialize("OperationResultContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(
+ AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[_models.OperationResultContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[_models.OperationResultContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_config_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_config_operations.py
index 6e9b65e0193d..6110e02f93d2 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_config_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_config_operations.py
@@ -7,8 +7,11 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
@@ -18,14 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._portal_config_operations import (
build_create_or_update_request,
build_get_entity_tag_request,
@@ -33,8 +35,11 @@
build_list_by_service_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -58,10 +63,10 @@ def __init__(self, *args, **kwargs) -> None:
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
- @distributed_trace_async
- async def list_by_service(
+ @distributed_trace
+ def list_by_service(
self, resource_group_name: str, service_name: str, **kwargs: Any
- ) -> _models.PortalConfigCollection:
+ ) -> AsyncIterable["_models.PortalConfigContract"]:
"""Lists the developer portal configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -69,53 +74,80 @@ async def list_by_service(
:type resource_group_name: str
:param service_name: The name of the API Management service. Required.
:type service_name: str
- :return: PortalConfigCollection or the result of cls(response)
- :rtype: ~azure.mgmt.apimanagement.models.PortalConfigCollection
+ :return: An iterator like instance of either PortalConfigContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.PortalConfigContract]
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
- 401: ClientAuthenticationError,
- 404: ResourceNotFoundError,
- 409: ResourceExistsError,
- 304: ResourceNotModifiedError,
- }
- error_map.update(kwargs.pop("error_map", {}) or {})
-
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PortalConfigCollection] = kwargs.pop("cls", None)
- _request = build_list_by_service_request(
- resource_group_name=resource_group_name,
- service_name=service_name,
- subscription_id=self._config.subscription_id,
- api_version=api_version,
- headers=_headers,
- params=_params,
- )
- _request = _convert_request(_request)
- _request.url = self._client.format_url(_request.url)
-
- _stream = False
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- _request, stream=_stream, **kwargs
- )
-
- response = pipeline_response.http_response
-
- if response.status_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("PortalConfigCollection", pipeline_response)
-
- if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
- return deserialized # type: ignore
+ 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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("PortalConfigCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
@distributed_trace_async
async def get_entity_tag(
@@ -134,7 +166,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -157,7 +189,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -196,7 +227,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -219,7 +250,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -237,7 +267,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PortalConfigContract", pipeline_response)
+ deserialized = self._deserialize("PortalConfigContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -341,7 +371,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -377,7 +407,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -392,7 +421,7 @@ async def update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PortalConfigContract", pipeline_response)
+ deserialized = self._deserialize("PortalConfigContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -496,7 +525,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -532,7 +561,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -547,7 +575,7 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PortalConfigContract", pipeline_response)
+ deserialized = self._deserialize("PortalConfigContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 f0c549b59fd3..ee62ac90d3cf 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +32,6 @@
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,
build_get_entity_tag_request,
@@ -38,8 +39,11 @@
build_list_by_service_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -109,7 +113,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PortalRevisionCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -131,7 +135,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -147,7 +150,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -195,7 +197,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -218,7 +220,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -258,7 +259,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.PortalRevisionContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -281,7 +282,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -299,7 +299,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ deserialized = self._deserialize("PortalRevisionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -313,8 +313,8 @@ async def _create_or_update_initial(
portal_revision_id: str,
parameters: Union[_models.PortalRevisionContract, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.PortalRevisionContract]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -327,7 +327,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PortalRevisionContract]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -349,27 +349,33 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [201, 202]:
+ if response.status_code not in [201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
response_headers = {}
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -494,14 +500,19 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ deserialized = self._deserialize("PortalRevisionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
@@ -533,8 +544,8 @@ async def _update_initial(
if_match: str,
parameters: Union[_models.PortalRevisionContract, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.PortalRevisionContract]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -547,7 +558,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PortalRevisionContract]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -570,10 +581,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -581,16 +592,25 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = 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 response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -725,6 +745,7 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
@@ -732,7 +753,7 @@ def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ deserialized = self._deserialize("PortalRevisionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
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 77c5fd150ed8..b970f5d63dcc 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,17 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -66,7 +68,7 @@ async def list_by_service(
:rtype: ~azure.mgmt.apimanagement.models.PortalSettingsCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -88,7 +90,6 @@ async def list_by_service(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -103,7 +104,7 @@ async def list_by_service(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PortalSettingsCollection", pipeline_response)
+ deserialized = self._deserialize("PortalSettingsCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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
index 03f3dee131ef..926865681a62 100644
--- 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +32,6 @@
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,
build_delete_request,
@@ -39,8 +40,11 @@
build_list_by_service_request,
build_list_private_link_resources_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -87,7 +91,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,7 +110,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -122,7 +125,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -169,7 +171,7 @@ async def get_by_name(
:rtype: ~azure.mgmt.apimanagement.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -192,7 +194,6 @@ async def get_by_name(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -207,7 +208,7 @@ async def get_by_name(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -221,8 +222,8 @@ async def _create_or_update_initial(
private_endpoint_connection_name: str,
private_endpoint_connection_request: Union[_models.PrivateEndpointConnectionRequest, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.PrivateEndpointConnection]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -235,7 +236,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -257,10 +258,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -268,16 +269,22 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
- if response.status_code == 200:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@@ -396,10 +403,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -421,10 +429,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, service_name: str, private_endpoint_connection_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -436,7 +444,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -447,10 +455,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -458,12 +466,24 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -491,7 +511,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
service_name=service_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -501,6 +521,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -537,7 +558,7 @@ async def list_private_link_resources(
:rtype: ~azure.mgmt.apimanagement.models.PrivateLinkResourceListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -559,7 +580,6 @@ async def list_private_link_resources(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -574,7 +594,7 @@ async def list_private_link_resources(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -598,7 +618,7 @@ async def get_private_link_resource(
:rtype: ~azure.mgmt.apimanagement.models.PrivateLinkResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -621,7 +641,6 @@ async def get_private_link_resource(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -636,7 +655,7 @@ async def get_private_link_resource(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResource", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_api_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_api_link_operations.py
new file mode 100644
index 000000000000..b3a8cea4c2aa
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_api_link_operations.py
@@ -0,0 +1,460 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._product_api_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class ProductApiLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`product_api_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.ProductApiLinkContract"]:
+ """Lists a collection of the API links associated with a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either ProductApiLinkContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ProductApiLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductApiLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("ProductApiLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, product_id: str, api_link_id: str, **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Gets the API link for the product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductApiLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ProductApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ api_link_id: str,
+ parameters: _models.ProductApiLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Adds an API to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ api_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Adds an API to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ api_link_id: str,
+ parameters: Union[_models.ProductApiLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Adds an API to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Is either a ProductApiLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductApiLinkContract or IO[bytes]
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ProductApiLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductApiLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, product_id: str, api_link_id: str, **kwargs: Any
+ ) -> None:
+ """Deletes the specified API from the specified product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # 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 1cf613ff7711..b768af9af703 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,23 +20,24 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -103,7 +105,7 @@ def list_by_product(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -126,7 +128,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -142,7 +143,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -193,7 +193,7 @@ async def check_entity_exists(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -217,7 +217,6 @@ async def check_entity_exists(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -257,7 +256,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ApiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -281,7 +280,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -296,11 +294,7 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("ApiContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ApiContract", pipeline_response)
+ deserialized = self._deserialize("ApiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -328,7 +322,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -352,7 +346,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_group_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_group_link_operations.py
new file mode 100644
index 000000000000..f4433574e2cb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_group_link_operations.py
@@ -0,0 +1,460 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._product_group_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class ProductGroupLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`product_group_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.ProductGroupLinkContract"]:
+ """Lists a collection of the group links associated with a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| groupId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either ProductGroupLinkContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ProductGroupLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductGroupLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("ProductGroupLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, product_id: str, group_link_id: str, **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Gets the group link for the product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductGroupLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ProductGroupLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ group_link_id: str,
+ parameters: _models.ProductGroupLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Adds a group to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ group_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Adds a group to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ group_link_id: str,
+ parameters: Union[_models.ProductGroupLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Adds a group to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :param parameters: Create or update parameters. Is either a ProductGroupLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract or IO[bytes]
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ProductGroupLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductGroupLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, product_id: str, group_link_id: str, **kwargs: Any
+ ) -> None:
+ """Deletes the specified group from the specified product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # 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 eb6e7f7ff8a3..66245ac4a0a6 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,23 +20,24 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -99,7 +101,7 @@ def list_by_product(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GroupCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -122,7 +124,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -138,7 +139,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -189,7 +189,7 @@ async def check_entity_exists(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -213,7 +213,6 @@ async def check_entity_exists(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -253,7 +252,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.GroupContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -277,7 +276,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -292,11 +290,7 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("GroupContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("GroupContract", pipeline_response)
+ deserialized = self._deserialize("GroupContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -324,7 +318,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -348,7 +342,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 895e92a68c2b..aa8317aca198 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -38,8 +37,11 @@
build_list_by_tags_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -111,7 +113,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ProductCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -135,7 +137,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -151,7 +152,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -197,7 +197,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, prod
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -220,7 +220,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, prod
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -260,7 +259,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.ProductContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -283,7 +282,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -301,7 +299,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ProductContract", pipeline_response)
+ deserialized = self._deserialize("ProductContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -408,7 +406,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ProductContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -444,7 +442,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -460,15 +457,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ProductContract", pipeline_response)
+ deserialized = self._deserialize("ProductContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -575,7 +566,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.ProductContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -611,7 +602,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -629,7 +619,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ProductContract", pipeline_response)
+ deserialized = self._deserialize("ProductContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -666,7 +656,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -691,7 +681,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -753,7 +742,7 @@ def list_by_tags(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -776,7 +765,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -792,7 +780,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 b5b309742b0a..61c142666600 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
@@ -7,8 +7,11 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
@@ -18,14 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -33,8 +35,11 @@
build_get_request,
build_list_by_product_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -58,10 +63,10 @@ def __init__(self, *args, **kwargs) -> None:
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
- @distributed_trace_async
- async def list_by_product(
+ @distributed_trace
+ def list_by_product(
self, resource_group_name: str, service_name: str, product_id: str, **kwargs: Any
- ) -> _models.PolicyCollection:
+ ) -> AsyncIterable["_models.PolicyContract"]:
"""Get the policy configuration at the Product level.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -72,54 +77,80 @@ async def list_by_product(
:param product_id: Product identifier. Must be unique in the current API Management service
instance. Required.
:type product_id: str
- :return: PolicyCollection or the result of cls(response)
- :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection
+ :return: An iterator like instance of either PolicyContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.PolicyContract]
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
- 401: ClientAuthenticationError,
- 404: ResourceNotFoundError,
- 409: ResourceExistsError,
- 304: ResourceNotModifiedError,
- }
- error_map.update(kwargs.pop("error_map", {}) or {})
-
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None)
- _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,
- api_version=api_version,
- headers=_headers,
- params=_params,
- )
- _request = _convert_request(_request)
- _request.url = self._client.format_url(_request.url)
-
- _stream = False
- pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- _request, stream=_stream, **kwargs
- )
-
- response = pipeline_response.http_response
-
- if response.status_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("PolicyCollection", pipeline_response)
-
- if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
- return deserialized # type: ignore
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
@distributed_trace_async
async def get_entity_tag(
@@ -146,7 +177,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -170,7 +201,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -221,7 +251,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -246,7 +276,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -264,7 +293,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -380,7 +409,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -417,7 +446,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -433,15 +461,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -477,7 +499,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -502,7 +524,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 d14ab1fb3888..1136f4efefd7 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,17 +20,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -102,7 +104,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SubscriptionCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -125,7 +127,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -141,7 +142,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wiki_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wiki_operations.py
index a3ca08f65521..7fbf3c890f6e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wiki_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wiki_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,14 +19,12 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._product_wiki_operations import (
build_create_or_update_request,
build_delete_request,
@@ -33,8 +32,11 @@
build_get_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -74,7 +76,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, prod
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -97,7 +99,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, prod
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -137,7 +138,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.WikiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -160,7 +161,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -178,7 +178,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("WikiContract", pipeline_response)
+ deserialized = self._deserialize("WikiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -285,7 +285,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.WikiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -321,7 +321,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -337,15 +336,9 @@ async def create_or_update(
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("WikiContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("WikiContract", pipeline_response)
+ deserialized = self._deserialize("WikiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -452,7 +445,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.WikiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -488,7 +481,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -506,7 +498,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("WikiContract", pipeline_response)
+ deserialized = self._deserialize("WikiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -534,7 +526,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -558,7 +550,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wikis_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wikis_operations.py
index 2c2606a23e70..1158434368ef 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wikis_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wikis_operations.py
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,17 +20,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._product_wikis_operations import build_list_request
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -92,7 +94,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WikiCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -115,7 +117,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -131,7 +132,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 ee0aeabcc296..8d6e184402f6 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,17 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -77,7 +79,7 @@ async def list_by_service(
:rtype: ~azure.mgmt.apimanagement.models.QuotaCounterCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -100,7 +102,6 @@ async def list_by_service(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -115,7 +116,7 @@ async def list_by_service(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("QuotaCounterCollection", pipeline_response)
+ deserialized = self._deserialize("QuotaCounterCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -221,7 +222,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.QuotaCounterCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -256,7 +257,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -271,7 +271,7 @@ async def update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("QuotaCounterCollection", pipeline_response)
+ deserialized = self._deserialize("QuotaCounterCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 93f162491d7e..97dc9f2fd362 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,17 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -79,7 +81,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.QuotaCounterContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,7 +105,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -118,7 +119,7 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("QuotaCounterContract", pipeline_response)
+ deserialized = self._deserialize("QuotaCounterContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -230,7 +231,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.QuotaCounterContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -266,7 +267,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -281,7 +281,7 @@ async def update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("QuotaCounterContract", pipeline_response)
+ deserialized = self._deserialize("QuotaCounterContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 2430035d6d73..c3d01de808d9 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,17 +20,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -75,7 +77,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.RegionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -94,7 +96,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -110,7 +111,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 a9b25627e75c..823b836f895b 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import datetime
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,14 +21,12 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
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,
@@ -38,8 +37,11 @@
build_list_by_time_request,
build_list_by_user_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -101,7 +103,7 @@ def list_by_api(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -124,7 +126,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -140,7 +141,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -221,7 +221,7 @@ def list_by_user(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -244,7 +244,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -260,7 +259,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -341,7 +339,7 @@ def list_by_operation(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -364,7 +362,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -380,7 +377,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -460,7 +456,7 @@ def list_by_product(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -483,7 +479,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -499,7 +494,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -576,7 +570,7 @@ def list_by_geo(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -598,7 +592,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -614,7 +607,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -694,7 +686,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -717,7 +709,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -733,7 +724,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -818,7 +808,7 @@ def list_by_time(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -842,7 +832,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -858,7 +847,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -927,7 +915,7 @@ def list_by_request(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.RequestReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -949,7 +937,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -965,7 +952,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 31ed31241af4..5bd8cdc452f5 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,22 +19,23 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -70,7 +72,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -92,7 +94,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -127,7 +128,7 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any)
:rtype: ~azure.mgmt.apimanagement.models.PortalSigninSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -149,7 +150,6 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any)
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -167,7 +167,7 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any)
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PortalSigninSettings", pipeline_response)
+ deserialized = self._deserialize("PortalSigninSettings", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -262,7 +262,7 @@ async def update( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -297,7 +297,6 @@ async def update( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -403,7 +402,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PortalSigninSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -438,7 +437,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -453,7 +451,7 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PortalSigninSettings", pipeline_response)
+ deserialized = self._deserialize("PortalSigninSettings", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 75ea36c46929..d392870c74e2 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,22 +19,23 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -70,7 +72,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -92,7 +94,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, **kw
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -127,7 +128,7 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any)
:rtype: ~azure.mgmt.apimanagement.models.PortalSignupSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -149,7 +150,6 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any)
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -167,7 +167,7 @@ async def get(self, resource_group_name: str, service_name: str, **kwargs: Any)
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PortalSignupSettings", pipeline_response)
+ deserialized = self._deserialize("PortalSignupSettings", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -262,7 +262,7 @@ async def update( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -297,7 +297,6 @@ async def update( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -403,7 +402,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PortalSignupSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -438,7 +437,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -453,7 +451,7 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PortalSignupSettings", pipeline_response)
+ deserialized = self._deserialize("PortalSignupSettings", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 c503b0260b7f..4ea05614d677 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -40,8 +39,11 @@
build_regenerate_secondary_key_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -110,7 +112,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SubscriptionCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -132,7 +134,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -148,7 +149,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -195,7 +195,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sid:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -218,7 +218,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, sid:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -258,7 +257,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -281,7 +280,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -299,7 +297,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -442,7 +440,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -480,7 +478,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -496,15 +493,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -647,7 +638,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -685,7 +676,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -703,7 +693,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -731,7 +721,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -755,7 +745,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -791,7 +780,7 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -814,7 +803,6 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -850,7 +838,7 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -873,7 +861,6 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -909,7 +896,7 @@ async def list_secrets(
:rtype: ~azure.mgmt.apimanagement.models.SubscriptionKeysContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -932,7 +919,6 @@ async def list_secrets(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -950,7 +936,7 @@ async def list_secrets(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("SubscriptionKeysContract", pipeline_response)
+ deserialized = self._deserialize("SubscriptionKeysContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_api_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_api_link_operations.py
new file mode 100644
index 000000000000..8bb14abfd440
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_api_link_operations.py
@@ -0,0 +1,459 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._tag_api_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class TagApiLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`tag_api_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.TagApiLinkContract"]:
+ """Lists a collection of the API links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either TagApiLinkContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagApiLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagApiLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagApiLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, tag_id: str, api_link_id: str, **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Gets the API link for the tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagApiLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ api_link_id: str,
+ parameters: _models.TagApiLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Adds an API to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ api_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Adds an API to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ api_link_id: str,
+ parameters: Union[_models.TagApiLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Adds an API to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Is either a TagApiLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagApiLinkContract or IO[bytes]
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagApiLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagApiLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, tag_id: str, api_link_id: str, **kwargs: Any
+ ) -> None:
+ """Deletes the specified API from the specified tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operation_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operation_link_operations.py
new file mode 100644
index 000000000000..6a0eab44b551
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operation_link_operations.py
@@ -0,0 +1,460 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._tag_operation_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class TagOperationLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`tag_operation_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.TagOperationLinkContract"]:
+ """Lists a collection of the operation links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| operationId
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either TagOperationLinkContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagOperationLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagOperationLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagOperationLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, tag_id: str, operation_link_id: str, **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Gets the operation link for the tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagOperationLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagOperationLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ operation_link_id: str,
+ parameters: _models.TagOperationLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Adds an operation to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ operation_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Adds an operation to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ operation_link_id: str,
+ parameters: Union[_models.TagOperationLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Adds an operation to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :param parameters: Create or update parameters. Is either a TagOperationLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagOperationLinkContract or IO[bytes]
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagOperationLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagOperationLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, tag_id: str, operation_link_id: str, **kwargs: Any
+ ) -> None:
+ """Deletes the specified operation from the specified tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # 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 0808b14c39ac..918bf3126e0c 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -52,8 +51,11 @@
build_list_by_service_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -122,7 +124,7 @@ def list_by_operation(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -146,7 +148,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -162,7 +163,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -216,7 +216,7 @@ async def get_entity_state_by_operation(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -241,7 +241,6 @@ async def get_entity_state_by_operation(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -287,7 +286,7 @@ async def get_by_operation(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -312,7 +311,6 @@ async def get_by_operation(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -330,7 +328,7 @@ async def get_by_operation(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -361,7 +359,7 @@ async def assign_to_operation(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -386,7 +384,6 @@ async def assign_to_operation(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -401,11 +398,7 @@ async def assign_to_operation(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("TagContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -436,7 +429,7 @@ async def detach_from_operation( # pylint: disable=inconsistent-return-statemen
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -461,7 +454,6 @@ async def detach_from_operation( # pylint: disable=inconsistent-return-statemen
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -520,7 +512,7 @@ def list_by_api(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -543,7 +535,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -559,7 +550,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -610,7 +600,7 @@ async def get_entity_state_by_api(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -634,7 +624,6 @@ async def get_entity_state_by_api(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -677,7 +666,7 @@ async def get_by_api(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -701,7 +690,6 @@ async def get_by_api(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -719,7 +707,7 @@ async def get_by_api(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -747,7 +735,7 @@ async def assign_to_api(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -771,7 +759,6 @@ async def assign_to_api(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -787,15 +774,9 @@ async def assign_to_api(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -823,7 +804,7 @@ async def detach_from_api( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -847,7 +828,6 @@ async def detach_from_api( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -906,7 +886,7 @@ def list_by_product(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -929,7 +909,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -945,7 +924,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -996,7 +974,7 @@ async def get_entity_state_by_product(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1020,7 +998,6 @@ async def get_entity_state_by_product(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1063,7 +1040,7 @@ async def get_by_product(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1087,7 +1064,6 @@ async def get_by_product(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1105,7 +1081,7 @@ async def get_by_product(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1133,7 +1109,7 @@ async def assign_to_product(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1157,7 +1133,6 @@ async def assign_to_product(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1172,11 +1147,7 @@ async def assign_to_product(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("TagContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1204,7 +1175,7 @@ async def detach_from_product( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1228,7 +1199,6 @@ async def detach_from_product( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1286,7 +1256,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1309,7 +1279,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1325,7 +1294,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1371,7 +1339,7 @@ async def get_entity_state(self, resource_group_name: str, service_name: str, ta
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1394,7 +1362,6 @@ async def get_entity_state(self, resource_group_name: str, service_name: str, ta
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1432,7 +1399,7 @@ async def get(self, resource_group_name: str, service_name: str, tag_id: str, **
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1455,7 +1422,6 @@ async def get(self, resource_group_name: str, service_name: str, tag_id: str, **
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1473,7 +1439,7 @@ async def get(self, resource_group_name: str, service_name: str, tag_id: str, **
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1580,7 +1546,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1616,7 +1582,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1632,15 +1597,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1747,7 +1706,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1783,7 +1742,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1801,7 +1759,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1829,7 +1787,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1853,7 +1811,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_product_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_product_link_operations.py
new file mode 100644
index 000000000000..e2a72049353f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_product_link_operations.py
@@ -0,0 +1,460 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._tag_product_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class TagProductLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`tag_product_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.TagProductLinkContract"]:
+ """Lists a collection of the product links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| productId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either TagProductLinkContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagProductLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagProductLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagProductLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, tag_id: str, product_link_id: str, **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Gets the product link for the tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagProductLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagProductLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ product_link_id: str,
+ parameters: _models.TagProductLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Adds a product to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ product_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Adds a product to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ product_link_id: str,
+ parameters: Union[_models.TagProductLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Adds a product to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :param parameters: Create or update parameters. Is either a TagProductLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagProductLinkContract or IO[bytes]
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagProductLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagProductLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, tag_id: str, product_link_id: str, **kwargs: Any
+ ) -> None:
+ """Deletes the specified product from the specified tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # 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 7ef5e240eb89..15d18dad75b1 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,17 +20,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -101,7 +103,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -123,7 +125,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -139,7 +140,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 22ae77fbcf25..3a2bdf0abe7c 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar, Union
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,20 +18,21 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -72,7 +74,7 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -95,7 +97,6 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -131,7 +132,7 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -154,7 +155,6 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 e5ab1f9079cf..fe67ba3a69a1 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
@@ -39,8 +38,11 @@
build_regenerate_secondary_key_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -89,7 +91,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AccessInformationCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -109,7 +111,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -125,7 +126,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -173,7 +173,7 @@ async def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -196,7 +196,6 @@ async def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -236,7 +235,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -259,7 +258,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -277,7 +275,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AccessInformationContract", pipeline_response)
+ deserialized = self._deserialize("AccessInformationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -385,7 +383,7 @@ async def create(
:rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -421,7 +419,6 @@ async def create(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -439,7 +436,7 @@ async def create(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AccessInformationContract", pipeline_response)
+ deserialized = self._deserialize("AccessInformationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -547,7 +544,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -583,7 +580,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -601,7 +597,7 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AccessInformationContract", pipeline_response)
+ deserialized = self._deserialize("AccessInformationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -626,7 +622,7 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -649,7 +645,6 @@ async def regenerate_primary_key( # pylint: disable=inconsistent-return-stateme
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -685,7 +680,7 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -708,7 +703,6 @@ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-state
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -744,7 +738,7 @@ async def list_secrets(
:rtype: ~azure.mgmt.apimanagement.models.AccessInformationSecretsContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -767,7 +761,6 @@ async def list_secrets(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -785,7 +778,7 @@ async def list_secrets(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AccessInformationSecretsContract", pipeline_response)
+ deserialized = self._deserialize("AccessInformationSecretsContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # 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 a58d583d0d43..eea6e7b1cc33 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,27 +16,30 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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,
build_get_sync_state_request,
build_save_request,
build_validate_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -66,8 +70,8 @@ async def _deploy_initial(
configuration_name: Union[str, _models.ConfigurationIdName],
parameters: Union[_models.DeployConfigurationParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.OperationResultContract]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -80,7 +84,7 @@ async def _deploy_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.OperationResultContract]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -102,10 +106,10 @@ async def _deploy_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -113,16 +117,22 @@ async def _deploy_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@@ -257,10 +267,11 @@ async def begin_deploy(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ deserialized = self._deserialize("OperationResultContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -291,8 +302,8 @@ async def _save_initial(
configuration_name: Union[str, _models.ConfigurationIdName],
parameters: Union[_models.SaveConfigurationParameter, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.OperationResultContract]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -305,7 +316,7 @@ async def _save_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.OperationResultContract]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -327,10 +338,10 @@ async def _save_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -338,16 +349,22 @@ async def _save_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@@ -482,10 +499,11 @@ async def begin_save(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ deserialized = self._deserialize("OperationResultContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -516,8 +534,8 @@ async def _validate_initial(
configuration_name: Union[str, _models.ConfigurationIdName],
parameters: Union[_models.DeployConfigurationParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.OperationResultContract]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -530,7 +548,7 @@ async def _validate_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.OperationResultContract]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -552,10 +570,10 @@ async def _validate_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -563,16 +581,22 @@ async def _validate_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@@ -695,10 +719,11 @@ async def begin_validate(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ deserialized = self._deserialize("OperationResultContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -745,7 +770,7 @@ async def get_sync_state(
:rtype: ~azure.mgmt.apimanagement.models.TenantConfigurationSyncStateContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -768,7 +793,6 @@ async def get_sync_state(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -783,7 +807,7 @@ async def get_sync_state(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("TenantConfigurationSyncStateContract", pipeline_response)
+ deserialized = self._deserialize("TenantConfigurationSyncStateContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 51561c84c15f..1d1ad0998e2f 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,18 +20,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -79,7 +81,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TenantSettingsCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -99,7 +101,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -115,7 +116,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -166,7 +166,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.TenantSettingsContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -189,7 +189,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -207,7 +206,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TenantSettingsContract", pipeline_response)
+ deserialized = self._deserialize("TenantSettingsContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # 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 ad0c4bab9d48..c37812ec09ed 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar, Union
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,17 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -78,7 +80,7 @@ async def send( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -102,7 +104,6 @@ async def send( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 281372237763..d0af2780ffb1 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,17 +20,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -96,7 +98,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GroupCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -119,7 +121,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -135,7 +136,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 c02e5c5602a3..6135f967ae1d 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,17 +20,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -79,7 +81,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.UserIdentityCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -99,7 +101,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -115,7 +116,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 ea76c91cc15a..0265004c9ca7 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,18 +18,20 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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._user_operations import (
build_create_or_update_request,
build_delete_request,
@@ -39,8 +42,11 @@
build_list_by_service_request,
build_update_request,
)
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -108,7 +114,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.UserCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -131,7 +137,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -147,7 +152,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -193,7 +197,7 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, user
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -216,7 +220,6 @@ async def get_entity_tag(self, resource_group_name: str, service_name: str, user
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -256,7 +259,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.UserContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -279,7 +282,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -297,7 +299,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("UserContract", pipeline_response)
+ deserialized = self._deserialize("UserContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -413,7 +415,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.UserContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -450,7 +452,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -466,15 +467,9 @@ async def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("UserContract", pipeline_response)
+ deserialized = self._deserialize("UserContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -581,7 +576,7 @@ async def update(
:rtype: ~azure.mgmt.apimanagement.models.UserContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -617,7 +612,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -635,15 +629,14 @@ async def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("UserContract", pipeline_response)
+ deserialized = self._deserialize("UserContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
- @distributed_trace_async
- async def delete( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
service_name: str,
@@ -653,34 +646,8 @@ async def delete( # pylint: disable=inconsistent-return-statements
notify: Optional[bool] = None,
app_type: Optional[Union[str, _models.AppType]] = None,
**kwargs: Any
- ) -> None:
- """Deletes specific user.
-
- :param resource_group_name: The name of the resource group. The name is case insensitive.
- Required.
- :type resource_group_name: str
- :param service_name: The name of the API Management service. Required.
- :type service_name: str
- :param user_id: User identifier. Must be unique in the current API Management service instance.
- Required.
- :type user_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. Required.
- :type if_match: str
- :param delete_subscriptions: Whether to delete user's subscription or not. Default value is
- None.
- :type delete_subscriptions: bool
- :param notify: Send an Account Closed Email notification to the User. Default value is None.
- :type notify: bool
- :param app_type: Determines the type of application which send the create user request. Default
- is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
- None.
- :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
- :return: None or the result of cls(response)
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
- """
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -692,7 +659,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -707,23 +674,123 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [200, 204]:
+ if response.status_code not in [202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def begin_delete(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ user_id: str,
+ if_match: str,
+ delete_subscriptions: Optional[bool] = None,
+ notify: Optional[bool] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ **kwargs: Any
+ ) -> AsyncLROPoller[None]:
+ """Deletes specific user.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_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. Required.
+ :type if_match: str
+ :param delete_subscriptions: Whether to delete user's subscription or not. Default value is
+ None.
+ :type delete_subscriptions: bool
+ :param notify: Send an Account Closed Email notification to the User. Default value is None.
+ :type notify: bool
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :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:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._delete_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ user_id=user_id,
+ if_match=if_match,
+ delete_subscriptions=delete_subscriptions,
+ notify=notify,
+ app_type=app_type,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(
+ AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[None].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace_async
async def generate_sso_url(
@@ -744,7 +811,7 @@ async def generate_sso_url(
:rtype: ~azure.mgmt.apimanagement.models.GenerateSsoUrlResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -767,7 +834,6 @@ async def generate_sso_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -782,7 +848,7 @@ async def generate_sso_url(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("GenerateSsoUrlResult", pipeline_response)
+ deserialized = self._deserialize("GenerateSsoUrlResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -877,7 +943,7 @@ async def get_shared_access_token(
:rtype: ~azure.mgmt.apimanagement.models.UserTokenResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -912,7 +978,6 @@ async def get_shared_access_token(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -927,7 +992,7 @@ async def get_shared_access_token(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("UserTokenResult", pipeline_response)
+ deserialized = self._deserialize("UserTokenResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 65f8bf298d87..5800056c32c3 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -19,18 +20,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
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
-from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -102,7 +104,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SubscriptionCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -125,7 +127,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -141,7 +142,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -192,7 +192,7 @@ async def get(
:rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -216,7 +216,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -234,7 +233,7 @@ async def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_diagnostic_operations.py
new file mode 100644
index 000000000000..d94d6cd6a659
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_diagnostic_operations.py
@@ -0,0 +1,782 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_api_diagnostic_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_entity_tag_request,
+ build_get_request,
+ build_list_by_workspace_request,
+ build_update_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceApiDiagnosticOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_api_diagnostic` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_workspace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.DiagnosticContract"]:
+ """Lists all diagnostics of an API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either DiagnosticContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.DiagnosticContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.DiagnosticCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_workspace_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Gets the details of the Diagnostic for an API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("DiagnosticContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ parameters: _models.DiagnosticContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Creates a new Diagnostic for an API or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Creates a new Diagnostic for an API or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ parameters: Union[_models.DiagnosticContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Creates a new Diagnostic for an API or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :param parameters: Create parameters. Is either a DiagnosticContract type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "DiagnosticContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ parameters: _models.DiagnosticUpdateContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Updates the details of the Diagnostic for an API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :param parameters: Diagnostic Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticUpdateContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Updates the details of the Diagnostic for an API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :param parameters: Diagnostic Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ parameters: Union[_models.DiagnosticUpdateContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Updates the details of the Diagnostic for an API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :param parameters: Diagnostic Update parameters. Is either a DiagnosticUpdateContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticUpdateContract or IO[bytes]
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "DiagnosticUpdateContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("DiagnosticContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified Diagnostic from an API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_export_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_export_operations.py
new file mode 100644
index 000000000000..8debb1518733
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_export_operations.py
@@ -0,0 +1,136 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_api_export_operations import build_get_request
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceApiExportOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_api_export` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ format: Union[str, _models.ExportFormat],
+ export: Union[str, _models.ExportApi],
+ **kwargs: Any
+ ) -> _models.ApiExportResult:
+ """Gets the details of the API specified by its identifier in the format specified to the Storage
+ Blob with SAS Key valid for 5 minutes.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param format: Format in which to export the Api Details to the Storage Blob with Sas Key valid
+ for 5 minutes. Known values are: "swagger-link", "wsdl-link", "wadl-link", "openapi-link", and
+ "openapi+json-link". Required.
+ :type format: str or ~azure.mgmt.apimanagement.models.ExportFormat
+ :param export: Query parameter required to export the API details. "true" Required.
+ :type export: str or ~azure.mgmt.apimanagement.models.ExportApi
+ :return: ApiExportResult or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiExportResult
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiExportResult] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ format=format,
+ export=export,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiExportResult", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operation_operations.py
new file mode 100644
index 000000000000..8a64d81556cd
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operation_operations.py
@@ -0,0 +1,790 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_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,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceApiOperationOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_api_operation` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_api(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ tags: Optional[str] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.OperationContract"]:
+ """Lists a collection of the operations for the specified API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains,
+ startswith, endswith |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param tags: Include tags in the response. Default value is None.
+ :type tags: str
+ :return: An iterator like instance of either OperationContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.OperationContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.OperationCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_api_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ tags=tags,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the API operation specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ **kwargs: Any
+ ) -> _models.OperationContract:
+ """Gets the details of the API Operation specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.OperationContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("OperationContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ parameters: _models.OperationContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.OperationContract:
+ """Creates a new operation in the API or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.OperationContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.OperationContract:
+ """Creates a new operation in the API or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ parameters: Union[_models.OperationContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.OperationContract:
+ """Creates a new operation in the API or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param parameters: Create parameters. Is either a OperationContract type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.OperationContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.OperationContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "OperationContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ if_match: str,
+ parameters: _models.OperationUpdateContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.OperationContract:
+ """Updates the details of the operation in the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_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. Required.
+ :type if_match: str
+ :param parameters: API Operation Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.OperationUpdateContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.OperationContract:
+ """Updates the details of the operation in the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_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. Required.
+ :type if_match: str
+ :param parameters: API Operation Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ if_match: str,
+ parameters: Union[_models.OperationUpdateContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.OperationContract:
+ """Updates the details of the operation in the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_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. Required.
+ :type if_match: str
+ :param parameters: API Operation Update parameters. Is either a OperationUpdateContract type or
+ a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.OperationUpdateContract or IO[bytes]
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.OperationContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "OperationUpdateContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("OperationContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified operation in the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operation_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operation_policy_operations.py
new file mode 100644
index 000000000000..bcc929f32a4a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operation_policy_operations.py
@@ -0,0 +1,612 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_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,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceApiOperationPolicyOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_api_operation_policy` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_operation(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.PolicyContract"]:
+ """Get the list of policy configuration at the API Operation level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :return: An iterator like instance of either PolicyContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.PolicyContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_operation_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the API operation policy specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Get the policy configuration at the API Operation level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is
+ "xml".
+ :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ format=format,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: _models.PolicyContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the API Operation level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the API Operation level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: Union[_models.PolicyContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the API Operation level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the policy configuration at the Api Operation.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operations.py
new file mode 100644
index 000000000000..ec9b9d659cfd
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operations.py
@@ -0,0 +1,834 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
+
+from ... import models as _models
+from ...operations._workspace_api_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,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceApiOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_api` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ tags: Optional[str] = None,
+ expand_api_version_set: Optional[bool] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.ApiContract"]:
+ """Lists all APIs of the workspace in an API Management service instance.
+
+ .. seealso::
+ - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-create-apis
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains,
+ startswith, endswith || path | filter | ge, le, eq, ne, gt, lt | substringof, contains,
+ startswith, endswith || isCurrent | filter | eq, ne | |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param tags: Include tags in the response. Default value is None.
+ :type tags: str
+ :param expand_api_version_set: Include full ApiVersionSet resource in response. Default value
+ is None.
+ :type expand_api_version_set: bool
+ :return: An iterator like instance of either ApiContract or the result of cls(response)
+ :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ tags=tags,
+ expand_api_version_set=expand_api_version_set,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, api_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, api_id: str, **kwargs: Any
+ ) -> _models.ApiContract:
+ """Gets the details of the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :return: ApiContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ async def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ parameters: Union[_models.ApiCreateOrUpdateParameter, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiCreateOrUpdateParameter")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ parameters: _models.ApiCreateOrUpdateParameter,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiContract]:
+ """Creates new or updates existing specified API of the workspace in an API Management service
+ instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiCreateOrUpdateParameter
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiContract]:
+ """Creates new or updates existing specified API of the workspace in an API Management service
+ instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @distributed_trace_async
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ parameters: Union[_models.ApiCreateOrUpdateParameter, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiContract]:
+ """Creates new or updates existing specified API of the workspace in an API Management service
+ instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param parameters: Create or update parameters. Is either a ApiCreateOrUpdateParameter type or
+ a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiCreateOrUpdateParameter or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :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:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ parameters=parameters,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("ApiContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(
+ AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[_models.ApiContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[_models.ApiContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ if_match: str,
+ parameters: _models.ApiUpdateContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiContract:
+ """Updates the specified API of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_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. Required.
+ :type if_match: str
+ :param parameters: API Update Contract parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiUpdateContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiContract:
+ """Updates the specified API of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_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. Required.
+ :type if_match: str
+ :param parameters: API Update Contract parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ if_match: str,
+ parameters: Union[_models.ApiUpdateContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ApiContract:
+ """Updates the specified API of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_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. Required.
+ :type if_match: str
+ :param parameters: API Update Contract parameters. Is either a ApiUpdateContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiUpdateContract or IO[bytes]
+ :return: ApiContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiUpdateContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ if_match: str,
+ delete_revisions: Optional[bool] = None,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified API of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_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. Required.
+ :type if_match: str
+ :param delete_revisions: Delete all revisions of the Api. Default value is None.
+ :type delete_revisions: bool
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ delete_revisions=delete_revisions,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_policy_operations.py
new file mode 100644
index 000000000000..61ad89faec55
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_policy_operations.py
@@ -0,0 +1,574 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_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,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceApiPolicyOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_api_policy` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_api(
+ self, resource_group_name: str, service_name: str, workspace_id: str, api_id: str, **kwargs: Any
+ ) -> AsyncIterable["_models.PolicyContract"]:
+ """Get the policy configuration at the API level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :return: An iterator like instance of either PolicyContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.PolicyContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_api_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the API policy specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Get the policy configuration at the API level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is
+ "xml".
+ :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ format=format,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: _models.PolicyContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: Union[_models.PolicyContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the policy configuration at the Api.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_release_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_release_operations.py
new file mode 100644
index 000000000000..a9a160736d62
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_release_operations.py
@@ -0,0 +1,784 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_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,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceApiReleaseOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_api_release` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.ApiReleaseContract"]:
+ """Lists all releases of an API. An API release is created when making an API Revision current.
+ Releases are also used to rollback to previous revisions. Results will be paged and can be
+ constrained by the $top and $skip parameters.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| notes |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either ApiReleaseContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiReleaseContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiReleaseCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ **kwargs: Any
+ ) -> bool:
+ """Returns the etag of an API release.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ release_id=release_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ **kwargs: Any
+ ) -> _models.ApiReleaseContract:
+ """Returns the details of an API release.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_id: str
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiReleaseContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ release_id=release_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiReleaseContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ parameters: _models.ApiReleaseContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiReleaseContract:
+ """Creates a new Release for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiReleaseContract:
+ """Creates a new Release for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ parameters: Union[_models.ApiReleaseContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.ApiReleaseContract:
+ """Creates a new Release for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_id: str
+ :param parameters: Create parameters. Is either a ApiReleaseContract type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiReleaseContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiReleaseContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ release_id=release_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ if_match: str,
+ parameters: _models.ApiReleaseContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiReleaseContract:
+ """Updates the details of the release of the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_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. Required.
+ :type if_match: str
+ :param parameters: API Release Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiReleaseContract:
+ """Updates the details of the release of the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_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. Required.
+ :type if_match: str
+ :param parameters: API Release Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ if_match: str,
+ parameters: Union[_models.ApiReleaseContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ApiReleaseContract:
+ """Updates the details of the release of the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_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. Required.
+ :type if_match: str
+ :param parameters: API Release Update parameters. Is either a ApiReleaseContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO[bytes]
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiReleaseContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiReleaseContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ release_id=release_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiReleaseContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified release in the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ release_id=release_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_revision_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_revision_operations.py
new file mode 100644
index 000000000000..25225700276c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_revision_operations.py
@@ -0,0 +1,169 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_api_revision_operations import build_list_by_service_request
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceApiRevisionOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_api_revision` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.ApiRevisionContract"]:
+ """Lists all revisions of an API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiRevision
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either ApiRevisionContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiRevisionContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiRevisionCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_schema_operations.py
new file mode 100644
index 000000000000..0275d192d98a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_schema_operations.py
@@ -0,0 +1,676 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
+
+from ... import models as _models
+from ...operations._workspace_api_schema_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_entity_tag_request,
+ build_get_request,
+ build_list_by_api_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceApiSchemaOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_api_schema` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_api(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.SchemaContract"]:
+ """Get the schema configuration at the API level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| contentType
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either SchemaContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.SchemaContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.SchemaCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_api_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, api_id: 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. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, api_id: str, schema_id: str, **kwargs: Any
+ ) -> _models.SchemaContract:
+ """Get the schema configuration at the API level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :return: SchemaContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SchemaContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.SchemaContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("SchemaContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ async def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ parameters: Union[_models.SchemaContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "SchemaContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ parameters: _models.SchemaContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.SchemaContract]:
+ """Creates or updates schema configuration for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :param parameters: The schema contents to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SchemaContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.SchemaContract]:
+ """Creates or updates schema configuration for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :param parameters: The schema contents to apply. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @distributed_trace_async
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ parameters: Union[_models.SchemaContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.SchemaContract]:
+ """Creates or updates schema configuration for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :param parameters: The schema contents to apply. Is either a SchemaContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SchemaContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :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:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.SchemaContract] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ schema_id=schema_id,
+ parameters=parameters,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("SchemaContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(
+ AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[_models.SchemaContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[_models.SchemaContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ if_match: str,
+ force: Optional[bool] = None,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the schema configuration at the Api.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :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. Required.
+ :type if_match: str
+ :param force: If true removes all references to the schema before deleting it. Default value is
+ None.
+ :type force: bool
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ force=force,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_version_set_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_version_set_operations.py
new file mode 100644
index 000000000000..22a5c1a2ea5e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_version_set_operations.py
@@ -0,0 +1,726 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_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,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceApiVersionSetOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_api_version_set` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.ApiVersionSetContract"]:
+ """Lists a collection of API Version Sets in the specified workspace with a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either ApiVersionSetContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiVersionSetContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiVersionSetCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, version_set_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the Api Version Set specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ version_set_id=version_set_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, version_set_id: str, **kwargs: Any
+ ) -> _models.ApiVersionSetContract:
+ """Gets the details of the Api Version Set specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_id: str
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiVersionSetContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ version_set_id=version_set_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiVersionSetContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ parameters: _models.ApiVersionSetContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiVersionSetContract:
+ """Creates or Updates a Api Version Set.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiVersionSetContract:
+ """Creates or Updates a Api Version Set.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ parameters: Union[_models.ApiVersionSetContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.ApiVersionSetContract:
+ """Creates or Updates a Api Version Set.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_id: str
+ :param parameters: Create or update parameters. Is either a ApiVersionSetContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiVersionSetContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiVersionSetContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ version_set_id=version_set_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ if_match: str,
+ parameters: _models.ApiVersionSetUpdateParameters,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiVersionSetContract:
+ """Updates the details of the Api VersionSet specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetUpdateParameters
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiVersionSetContract:
+ """Updates the details of the Api VersionSet specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ if_match: str,
+ parameters: Union[_models.ApiVersionSetUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ApiVersionSetContract:
+ """Updates the details of the Api VersionSet specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a ApiVersionSetUpdateParameters type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetUpdateParameters or IO[bytes]
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiVersionSetContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiVersionSetUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ version_set_id=version_set_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiVersionSetContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes specific Api Version Set.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ version_set_id=version_set_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_backend_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_backend_operations.py
new file mode 100644
index 000000000000..4dbe73d178f5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_backend_operations.py
@@ -0,0 +1,728 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_backend_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_entity_tag_request,
+ build_get_request,
+ build_list_by_workspace_request,
+ build_update_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceBackendOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_backend` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_workspace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.BackendContract"]:
+ """Lists a collection of backends in the specified workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || title |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || url |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either BackendContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.BackendContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.BackendCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_workspace_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, backend_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the backend specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ backend_id=backend_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, backend_id: str, **kwargs: Any
+ ) -> _models.BackendContract:
+ """Gets the details of the backend specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_id: str
+ :return: BackendContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.BackendContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.BackendContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ backend_id=backend_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("BackendContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ parameters: _models.BackendContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.BackendContract:
+ """Creates or Updates a backend.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.BackendContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: BackendContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.BackendContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.BackendContract:
+ """Creates or Updates a backend.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: BackendContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.BackendContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ parameters: Union[_models.BackendContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.BackendContract:
+ """Creates or Updates a backend.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_id: str
+ :param parameters: Create parameters. Is either a BackendContract type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.BackendContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: BackendContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.BackendContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.BackendContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "BackendContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ backend_id=backend_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ if_match: str,
+ parameters: _models.BackendUpdateParameters,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.BackendContract:
+ """Updates an existing backend.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.BackendUpdateParameters
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: BackendContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.BackendContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.BackendContract:
+ """Updates an existing backend.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: BackendContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.BackendContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ if_match: str,
+ parameters: Union[_models.BackendUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.BackendContract:
+ """Updates an existing backend.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a BackendUpdateParameters type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.BackendUpdateParameters or IO[bytes]
+ :return: BackendContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.BackendContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.BackendContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "BackendUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ backend_id=backend_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("BackendContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified backend.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ backend_id=backend_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_certificate_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_certificate_operations.py
new file mode 100644
index 000000000000..544e41459117
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_certificate_operations.py
@@ -0,0 +1,646 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_certificate_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_entity_tag_request,
+ build_get_request,
+ build_list_by_workspace_request,
+ build_refresh_secret_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceCertificateOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_certificate` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_workspace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ is_key_vault_refresh_failed: Optional[bool] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.CertificateContract"]:
+ """Lists a collection of all certificates in the specified workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || subject |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || expirationDate | filter | ge, le, eq, ne, gt, lt | |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param is_key_vault_refresh_failed: When set to true, the response contains only certificates
+ entities which failed refresh. Default value is None.
+ :type is_key_vault_refresh_failed: bool
+ :return: An iterator like instance of either CertificateContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.CertificateContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.CertificateCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_workspace_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ is_key_vault_refresh_failed=is_key_vault_refresh_failed,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, certificate_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the certificate specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param certificate_id: Identifier of the certificate entity. Must be unique in the current API
+ Management service instance. Required.
+ :type certificate_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ certificate_id=certificate_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, certificate_id: str, **kwargs: Any
+ ) -> _models.CertificateContract:
+ """Gets the details of the certificate specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param certificate_id: Identifier of the certificate entity. Must be unique in the current API
+ Management service instance. Required.
+ :type certificate_id: str
+ :return: CertificateContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.CertificateContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.CertificateContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ certificate_id=certificate_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("CertificateContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ certificate_id: str,
+ parameters: _models.CertificateCreateOrUpdateParameters,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.CertificateContract:
+ """Creates or updates the certificate being used for authentication with the backend.
+
+ .. seealso::
+ -
+ https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param certificate_id: Identifier of the certificate entity. Must be unique in the current API
+ Management service instance. Required.
+ :type certificate_id: str
+ :param parameters: Create or Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.CertificateCreateOrUpdateParameters
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: CertificateContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.CertificateContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ certificate_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.CertificateContract:
+ """Creates or updates the certificate being used for authentication with the backend.
+
+ .. seealso::
+ -
+ https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param certificate_id: Identifier of the certificate entity. Must be unique in the current API
+ Management service instance. Required.
+ :type certificate_id: str
+ :param parameters: Create or Update parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: CertificateContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.CertificateContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ certificate_id: str,
+ parameters: Union[_models.CertificateCreateOrUpdateParameters, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.CertificateContract:
+ """Creates or updates the certificate being used for authentication with the backend.
+
+ .. seealso::
+ -
+ https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param certificate_id: Identifier of the certificate entity. Must be unique in the current API
+ Management service instance. Required.
+ :type certificate_id: str
+ :param parameters: Create or Update parameters. Is either a CertificateCreateOrUpdateParameters
+ type or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.CertificateCreateOrUpdateParameters or
+ IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: CertificateContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.CertificateContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.CertificateContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ certificate_id=certificate_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ certificate_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes specific certificate.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param certificate_id: Identifier of the certificate entity. Must be unique in the current API
+ Management service instance. Required.
+ :type certificate_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ certificate_id=certificate_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
+
+ @distributed_trace_async
+ async def refresh_secret(
+ self, resource_group_name: str, service_name: str, workspace_id: str, certificate_id: str, **kwargs: Any
+ ) -> _models.CertificateContract:
+ """From KeyVault, Refresh the certificate being used for authentication with the backend.
+
+ .. seealso::
+ -
+ https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param certificate_id: Identifier of the certificate entity. Must be unique in the current API
+ Management service instance. Required.
+ :type certificate_id: str
+ :return: CertificateContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.CertificateContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.CertificateContract] = kwargs.pop("cls", None)
+
+ _request = build_refresh_secret_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ certificate_id=certificate_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("CertificateContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_diagnostic_operations.py
new file mode 100644
index 000000000000..8b6b31b55ef3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_diagnostic_operations.py
@@ -0,0 +1,726 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_diagnostic_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_entity_tag_request,
+ build_get_request,
+ build_list_by_workspace_request,
+ build_update_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceDiagnosticOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_diagnostic` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_workspace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.DiagnosticContract"]:
+ """Lists all diagnostics in the specified workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either DiagnosticContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.DiagnosticContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.DiagnosticCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_workspace_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, diagnostic_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the Diagnostic specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, diagnostic_id: str, **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Gets the details of the Diagnostic specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("DiagnosticContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ parameters: _models.DiagnosticContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Creates a new Diagnostic or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Creates a new Diagnostic or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ parameters: Union[_models.DiagnosticContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Creates a new Diagnostic or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :param parameters: Create parameters. Is either a DiagnosticContract type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "DiagnosticContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ parameters: _models.DiagnosticUpdateContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Updates the details of the Diagnostic specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :param parameters: Diagnostic Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticUpdateContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Updates the details of the Diagnostic specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :param parameters: Diagnostic Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ parameters: Union[_models.DiagnosticUpdateContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Updates the details of the Diagnostic specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :param parameters: Diagnostic Update parameters. Is either a DiagnosticUpdateContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticUpdateContract or IO[bytes]
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "DiagnosticUpdateContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("DiagnosticContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified Diagnostic.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_global_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_global_schema_operations.py
new file mode 100644
index 000000000000..2c0c81a2781c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_global_schema_operations.py
@@ -0,0 +1,645 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
+
+from ... import models as _models
+from ...operations._workspace_global_schema_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_entity_tag_request,
+ build_get_request,
+ build_list_by_service_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceGlobalSchemaOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_global_schema` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.GlobalSchemaContract"]:
+ """Lists a collection of schemas registered with workspace in a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either GlobalSchemaContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GlobalSchemaContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.GlobalSchemaCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: 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. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: 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. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :return: GlobalSchemaContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GlobalSchemaContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.GlobalSchemaContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ async def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ parameters: Union[_models.GlobalSchemaContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GlobalSchemaContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ parameters: _models.GlobalSchemaContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.GlobalSchemaContract]:
+ """Creates new or updates existing specified Schema of the workspace in an API Management service
+ instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :param parameters: Create or update parameters. Required.
+ :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. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.GlobalSchemaContract]:
+ """Creates new or updates existing specified Schema of the workspace in an API Management service
+ instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @distributed_trace_async
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ parameters: Union[_models.GlobalSchemaContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.GlobalSchemaContract]:
+ """Creates new or updates existing specified Schema of the workspace in an API Management service
+ instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :param parameters: Create or update parameters. Is either a GlobalSchemaContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GlobalSchemaContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :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:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.GlobalSchemaContract] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ schema_id=schema_id,
+ parameters=parameters,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(
+ AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[_models.GlobalSchemaContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[_models.GlobalSchemaContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes specific Schema.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_group_operations.py
new file mode 100644
index 000000000000..de73f30ee978
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_group_operations.py
@@ -0,0 +1,730 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_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,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceGroupOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_group` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.GroupContract"]:
+ """Lists a collection of groups defined within a workspace in a service instance.
+
+ .. seealso::
+ - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-create-groups
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || externalId | filter | eq | |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either GroupContract or the result of cls(response)
+ :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GroupContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.GroupCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, group_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the group specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, group_id: str, **kwargs: Any
+ ) -> _models.GroupContract:
+ """Gets the details of the group specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.GroupContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("GroupContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ parameters: _models.GroupCreateParameters,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GroupContract:
+ """Creates or Updates a group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GroupCreateParameters
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GroupContract:
+ """Creates or Updates a group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ parameters: Union[_models.GroupCreateParameters, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.GroupContract:
+ """Creates or Updates a group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param parameters: Create parameters. Is either a GroupCreateParameters type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GroupCreateParameters or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.GroupContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GroupCreateParameters")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ if_match: str,
+ parameters: _models.GroupUpdateParameters,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GroupContract:
+ """Updates the details of the group specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GroupUpdateParameters
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GroupContract:
+ """Updates the details of the group specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ if_match: str,
+ parameters: Union[_models.GroupUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.GroupContract:
+ """Updates the details of the group specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a GroupUpdateParameters type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GroupUpdateParameters or IO[bytes]
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.GroupContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GroupUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("GroupContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes specific group of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_group_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_group_user_operations.py
new file mode 100644
index 000000000000..5f18e1832116
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_group_user_operations.py
@@ -0,0 +1,381 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_group_user_operations import (
+ build_check_entity_exists_request,
+ build_create_request,
+ build_delete_request,
+ build_list_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceGroupUserOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_group_user` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.UserContract"]:
+ """Lists a collection of user entities associated with the group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || firstName
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || registrationDate | filter | ge, le, eq, ne, gt, lt | || note | filter | ge,
+ le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either UserContract or the result of cls(response)
+ :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.UserContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.UserCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def check_entity_exists(
+ self, resource_group_name: str, service_name: str, workspace_id: str, group_id: str, user_id: str, **kwargs: Any
+ ) -> bool:
+ """Checks that user entity specified by identifier is associated with the group entity.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_check_entity_exists_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ user_id=user_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def create(
+ self, resource_group_name: str, service_name: str, workspace_id: str, group_id: str, user_id: str, **kwargs: Any
+ ) -> _models.UserContract:
+ """Add existing user to existing group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_id: str
+ :return: UserContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.UserContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.UserContract] = kwargs.pop("cls", None)
+
+ _request = build_create_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ user_id=user_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("UserContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, workspace_id: str, group_id: str, user_id: str, **kwargs: Any
+ ) -> None:
+ """Remove existing user from existing group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ user_id=user_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_logger_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_logger_operations.py
new file mode 100644
index 000000000000..3717551f2863
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_logger_operations.py
@@ -0,0 +1,731 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_logger_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_entity_tag_request,
+ build_get_request,
+ build_list_by_workspace_request,
+ build_update_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceLoggerOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_logger` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_workspace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.LoggerContract"]:
+ """Lists a collection of loggers in the specified workspace.
+
+ .. seealso::
+ - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-log-event-hubs
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || loggerType | filter | eq | || resourceId | filter | ge, le, eq, ne, gt, lt |
+ substringof, contains, startswith, endswith |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either LoggerContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.LoggerContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.LoggerCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_workspace_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, logger_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the logger specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ logger_id=logger_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, logger_id: str, **kwargs: Any
+ ) -> _models.LoggerContract:
+ """Gets the details of the logger specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_id: str
+ :return: LoggerContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.LoggerContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.LoggerContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ logger_id=logger_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("LoggerContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ parameters: _models.LoggerContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.LoggerContract:
+ """Creates or Updates a logger.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.LoggerContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: LoggerContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.LoggerContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.LoggerContract:
+ """Creates or Updates a logger.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: LoggerContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.LoggerContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ parameters: Union[_models.LoggerContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.LoggerContract:
+ """Creates or Updates a logger.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_id: str
+ :param parameters: Create parameters. Is either a LoggerContract type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.LoggerContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: LoggerContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.LoggerContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.LoggerContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "LoggerContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ logger_id=logger_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ if_match: str,
+ parameters: _models.LoggerUpdateContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.LoggerContract:
+ """Updates an existing logger.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.LoggerUpdateContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: LoggerContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.LoggerContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.LoggerContract:
+ """Updates an existing logger.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: LoggerContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.LoggerContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ if_match: str,
+ parameters: Union[_models.LoggerUpdateContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.LoggerContract:
+ """Updates an existing logger.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a LoggerUpdateContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.LoggerUpdateContract or IO[bytes]
+ :return: LoggerContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.LoggerContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.LoggerContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "LoggerUpdateContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ logger_id=logger_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("LoggerContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified logger.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ logger_id=logger_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_named_value_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_named_value_operations.py
new file mode 100644
index 000000000000..99002951becf
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_named_value_operations.py
@@ -0,0 +1,1099 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
+
+from ... import models as _models
+from ...operations._workspace_named_value_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_value_request,
+ build_refresh_secret_request,
+ build_update_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceNamedValueOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_named_value` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ is_key_vault_refresh_failed: Optional[Union[str, _models.KeyVaultRefreshState]] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.NamedValueContract"]:
+ """Lists a collection of named values defined within a workspace in a service instance.
+
+ .. seealso::
+ - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-properties
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| tags |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param is_key_vault_refresh_failed: Query parameter to fetch named value entities based on
+ refresh status. Known values are: "true" and "false". Default value is None.
+ :type is_key_vault_refresh_failed: str or ~azure.mgmt.apimanagement.models.KeyVaultRefreshState
+ :return: An iterator like instance of either NamedValueContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.NamedValueContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.NamedValueCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ is_key_vault_refresh_failed=is_key_vault_refresh_failed,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, named_value_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the named value specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, named_value_id: str, **kwargs: Any
+ ) -> _models.NamedValueContract:
+ """Gets the details of the named value specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_id: str
+ :return: NamedValueContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NamedValueContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("NamedValueContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ async def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ parameters: Union[_models.NamedValueCreateContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "NamedValueCreateContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ parameters: _models.NamedValueCreateContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.NamedValueContract]:
+ """Creates or updates named value.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.NamedValueCreateContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.NamedValueContract]:
+ """Creates or updates named value.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @distributed_trace_async
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ parameters: Union[_models.NamedValueCreateContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.NamedValueContract]:
+ """Creates or updates named value.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_id: str
+ :param parameters: Create parameters. Is either a NamedValueCreateContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.NamedValueCreateContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :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:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ parameters=parameters,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("NamedValueContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(
+ AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[_models.NamedValueContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[_models.NamedValueContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ async def _update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ if_match: str,
+ parameters: Union[_models.NamedValueUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "NamedValueUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def begin_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ if_match: str,
+ parameters: _models.NamedValueUpdateParameters,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.NamedValueContract]:
+ """Updates the specific named value.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.NamedValueUpdateParameters
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @overload
+ async def begin_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.NamedValueContract]:
+ """Updates the specific named value.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @distributed_trace_async
+ async def begin_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ if_match: str,
+ parameters: Union[_models.NamedValueUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.NamedValueContract]:
+ """Updates the specific named value.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a NamedValueUpdateParameters type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.NamedValueUpdateParameters or IO[bytes]
+ :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:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._update_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ if_match=if_match,
+ parameters=parameters,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ 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("NamedValueContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(
+ AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[_models.NamedValueContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[_models.NamedValueContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes specific named value from the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
+
+ @distributed_trace_async
+ async def list_value(
+ self, resource_group_name: str, service_name: str, workspace_id: str, named_value_id: str, **kwargs: Any
+ ) -> _models.NamedValueSecretContract:
+ """Gets the secret of the named value specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_id: str
+ :return: NamedValueSecretContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NamedValueSecretContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.NamedValueSecretContract] = kwargs.pop("cls", None)
+
+ _request = build_list_value_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("NamedValueSecretContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ async def _refresh_secret_initial(
+ self, resource_group_name: str, service_name: str, workspace_id: str, named_value_id: str, **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ _request = build_refresh_secret_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def begin_refresh_secret(
+ self, resource_group_name: str, service_name: str, workspace_id: str, named_value_id: str, **kwargs: Any
+ ) -> AsyncLROPoller[_models.NamedValueContract]:
+ """Refresh the secret of the named value specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_id: str
+ :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:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._refresh_secret_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ 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("NamedValueContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(
+ AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[_models.NamedValueContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[_models.NamedValueContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_notification_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_notification_operations.py
new file mode 100644
index 000000000000..fddcbdbf1ff5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_notification_operations.py
@@ -0,0 +1,314 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_notification_operations import (
+ build_create_or_update_request,
+ build_get_request,
+ build_list_by_service_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceNotificationOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_notification` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.NotificationContract"]:
+ """Lists a collection of properties defined within a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either NotificationContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.NotificationContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.NotificationCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ **kwargs: Any
+ ) -> _models.NotificationContract:
+ """Gets the details of the Notification specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :return: NotificationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NotificationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.NotificationContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("NotificationContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.NotificationContract:
+ """Create or Update API Management publisher notification for the workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: NotificationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NotificationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.NotificationContract] = kwargs.pop("cls", None)
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("NotificationContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_notification_recipient_email_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_notification_recipient_email_operations.py
new file mode 100644
index 000000000000..fefbcb21a250
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_notification_recipient_email_operations.py
@@ -0,0 +1,356 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_notification_recipient_email_operations import (
+ build_check_entity_exists_request,
+ build_create_or_update_request,
+ build_delete_request,
+ build_list_by_notification_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceNotificationRecipientEmailOperations: # pylint: disable=name-too-long
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_notification_recipient_email` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace_async
+ async def list_by_notification(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ **kwargs: Any
+ ) -> _models.RecipientEmailCollection:
+ """Gets the list of the Notification Recipient Emails subscribed to a notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :return: RecipientEmailCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientEmailCollection
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.RecipientEmailCollection] = kwargs.pop("cls", None)
+
+ _request = build_list_by_notification_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("RecipientEmailCollection", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def check_entity_exists(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ email: str,
+ **kwargs: Any
+ ) -> bool:
+ """Determine if Notification Recipient Email subscribed to the notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :param email: Email identifier. Required.
+ :type email: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_check_entity_exists_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ email=email,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ email: str,
+ **kwargs: Any
+ ) -> _models.RecipientEmailContract:
+ """Adds the Email address to the list of Recipients for the Notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :param email: Email identifier. Required.
+ :type email: str
+ :return: RecipientEmailContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientEmailContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.RecipientEmailContract] = kwargs.pop("cls", None)
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ email=email,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("RecipientEmailContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ email: str,
+ **kwargs: Any
+ ) -> None:
+ """Removes the email from the list of Notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :param email: Email identifier. Required.
+ :type email: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ email=email,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_notification_recipient_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_notification_recipient_user_operations.py
new file mode 100644
index 000000000000..6c78347b6579
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_notification_recipient_user_operations.py
@@ -0,0 +1,359 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_notification_recipient_user_operations import (
+ build_check_entity_exists_request,
+ build_create_or_update_request,
+ build_delete_request,
+ build_list_by_notification_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceNotificationRecipientUserOperations: # pylint: disable=name-too-long
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_notification_recipient_user` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace_async
+ async def list_by_notification(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ **kwargs: Any
+ ) -> _models.RecipientUserCollection:
+ """Gets the list of the Notification Recipient User subscribed to the notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :return: RecipientUserCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientUserCollection
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.RecipientUserCollection] = kwargs.pop("cls", None)
+
+ _request = build_list_by_notification_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("RecipientUserCollection", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def check_entity_exists(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ user_id: str,
+ **kwargs: Any
+ ) -> bool:
+ """Determine if the Notification Recipient User is subscribed to the notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_check_entity_exists_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ user_id=user_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ user_id: str,
+ **kwargs: Any
+ ) -> _models.RecipientUserContract:
+ """Adds the API Management User to the list of Recipients for the Notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_id: str
+ :return: RecipientUserContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientUserContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.RecipientUserContract] = kwargs.pop("cls", None)
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ user_id=user_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("RecipientUserContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ user_id: str,
+ **kwargs: Any
+ ) -> None:
+ """Removes the API Management user from the list of Notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ user_id=user_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_operations.py
new file mode 100644
index 000000000000..54ca33761818
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_operations.py
@@ -0,0 +1,678 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_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,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @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.WorkspaceContract"]:
+ """Lists all workspaces of the API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| displayName
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either WorkspaceContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.WorkspaceContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.WorkspaceCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("WorkspaceCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the workspace specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, **kwargs: Any
+ ) -> _models.WorkspaceContract:
+ """Gets the details of the workspace specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.WorkspaceContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("WorkspaceContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ parameters: _models.WorkspaceContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.WorkspaceContract:
+ """Creates a new workspace or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.WorkspaceContract:
+ """Creates a new workspace or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ parameters: Union[_models.WorkspaceContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.WorkspaceContract:
+ """Creates a new workspace or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param parameters: Create parameters. Is either a WorkspaceContract type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.WorkspaceContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.WorkspaceContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "WorkspaceContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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("WorkspaceContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ if_match: str,
+ parameters: _models.WorkspaceContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.WorkspaceContract:
+ """Updates the details of the workspace specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_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. Required.
+ :type if_match: str
+ :param parameters: Workspace Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.WorkspaceContract:
+ """Updates the details of the workspace specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_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. Required.
+ :type if_match: str
+ :param parameters: Workspace Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ if_match: str,
+ parameters: Union[_models.WorkspaceContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.WorkspaceContract:
+ """Updates the details of the workspace specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_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. Required.
+ :type if_match: str
+ :param parameters: Workspace Update parameters. Is either a WorkspaceContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.WorkspaceContract or IO[bytes]
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.WorkspaceContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "WorkspaceContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("WorkspaceContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, workspace_id: str, if_match: str, **kwargs: Any
+ ) -> None:
+ """Deletes the specified workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_policy_fragment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_policy_fragment_operations.py
new file mode 100644
index 000000000000..0a9334bd9d8a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_policy_fragment_operations.py
@@ -0,0 +1,725 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
+
+from ... import models as _models
+from ...operations._workspace_policy_fragment_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_references_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspacePolicyFragmentOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_policy_fragment` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ orderby: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.PolicyFragmentContract"]:
+ """Gets all policy fragments defined within a workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ |. Default value is None.
+ :type filter: str
+ :param orderby: OData order by query option. Default value is None.
+ :type orderby: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either PolicyFragmentContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.PolicyFragmentContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyFragmentCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ orderby=orderby,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyFragmentCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of a policy fragment.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param id: A resource identifier. Required.
+ :type id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ id=id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ format: Optional[Union[str, _models.PolicyFragmentContentFormat]] = None,
+ **kwargs: Any
+ ) -> _models.PolicyFragmentContract:
+ """Gets a policy fragment.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param id: A resource identifier. Required.
+ :type id: str
+ :param format: Policy fragment content format. Known values are: "xml" and "rawxml". Default
+ value is None.
+ :type format: str or ~azure.mgmt.apimanagement.models.PolicyFragmentContentFormat
+ :return: PolicyFragmentContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyFragmentContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyFragmentContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ id=id,
+ subscription_id=self._config.subscription_id,
+ format=format,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyFragmentContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ async def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ parameters: Union[_models.PolicyFragmentContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyFragmentContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ id=id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ parameters: _models.PolicyFragmentContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.PolicyFragmentContract]:
+ """Creates or updates a policy fragment.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param id: A resource identifier. Required.
+ :type id: str
+ :param parameters: The policy fragment contents to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyFragmentContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of AsyncLROPoller that returns either PolicyFragmentContract or the result
+ of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.PolicyFragmentContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.PolicyFragmentContract]:
+ """Creates or updates a policy fragment.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param id: A resource identifier. Required.
+ :type id: str
+ :param parameters: The policy fragment contents to apply. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of AsyncLROPoller that returns either PolicyFragmentContract or the result
+ of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.PolicyFragmentContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ parameters: Union[_models.PolicyFragmentContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.PolicyFragmentContract]:
+ """Creates or updates a policy fragment.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param id: A resource identifier. Required.
+ :type id: str
+ :param parameters: The policy fragment contents to apply. Is either a PolicyFragmentContract
+ type or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyFragmentContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: An instance of AsyncLROPoller that returns either PolicyFragmentContract or the result
+ of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.PolicyFragmentContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.PolicyFragmentContract] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ id=id,
+ parameters=parameters,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("PolicyFragmentContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(
+ AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[_models.PolicyFragmentContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[_models.PolicyFragmentContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, workspace_id: str, id: str, if_match: str, **kwargs: Any
+ ) -> None:
+ """Deletes a policy fragment.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param id: A resource identifier. Required.
+ :type 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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ id=id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
+
+ @distributed_trace_async
+ async def list_references(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> _models.ResourceCollection:
+ """Lists policy resources that reference the policy fragment.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param id: A resource identifier. Required.
+ :type id: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: ResourceCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ResourceCollection
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ResourceCollection] = kwargs.pop("cls", None)
+
+ _request = build_list_references_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ id=id,
+ subscription_id=self._config.subscription_id,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ResourceCollection", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_policy_operations.py
new file mode 100644
index 000000000000..31f3c8a10b72
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_policy_operations.py
@@ -0,0 +1,542 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_policy_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_entity_tag_request,
+ build_get_request,
+ build_list_by_api_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspacePolicyOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_policy` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_api(
+ self, resource_group_name: str, service_name: str, workspace_id: str, **kwargs: Any
+ ) -> AsyncIterable["_models.PolicyContract"]:
+ """Get the policy configuration at the workspace level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :return: An iterator like instance of either PolicyContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.PolicyContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_api_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the workspace policy specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Get the policy configuration at the API level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is
+ "xml".
+ :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ format=format,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: _models.PolicyContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: Union[_models.PolicyContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the policy configuration at the workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_api_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_api_link_operations.py
new file mode 100644
index 000000000000..08a69f78d694
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_api_link_operations.py
@@ -0,0 +1,498 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_product_api_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceProductApiLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_product_api_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.ProductApiLinkContract"]:
+ """Lists a collection of the API links associated with a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either ProductApiLinkContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ProductApiLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductApiLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("ProductApiLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Gets the API link for the product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductApiLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ProductApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ parameters: _models.ProductApiLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Adds an API to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Adds an API to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ parameters: Union[_models.ProductApiLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Adds an API to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Is either a ProductApiLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductApiLinkContract or IO[bytes]
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ProductApiLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductApiLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified API from the specified product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_group_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_group_link_operations.py
new file mode 100644
index 000000000000..1a1bd55d24eb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_group_link_operations.py
@@ -0,0 +1,498 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_product_group_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceProductGroupLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_product_group_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.ProductGroupLinkContract"]:
+ """Lists a collection of the group links associated with a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| groupId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either ProductGroupLinkContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ProductGroupLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductGroupLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("ProductGroupLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Gets the group link for the product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductGroupLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ProductGroupLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ parameters: _models.ProductGroupLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Adds a group to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Adds a group to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ parameters: Union[_models.ProductGroupLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Adds a group to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :param parameters: Create or update parameters. Is either a ProductGroupLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract or IO[bytes]
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ProductGroupLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductGroupLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified group from the specified product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_operations.py
new file mode 100644
index 000000000000..f68863a2281d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_operations.py
@@ -0,0 +1,744 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_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_update_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceProductOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_product` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ expand_groups: Optional[bool] = None,
+ tags: Optional[str] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.ProductContract"]:
+ """Lists a collection of products in the specified workspace in a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || state | filter | eq | || groups | expand | | |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param expand_groups: When set to true, the response contains an array of groups that have
+ visibility to the product. The default is false. Default value is None.
+ :type expand_groups: bool
+ :param tags: Products which are part of a specific tag. Default value is None.
+ :type tags: str
+ :return: An iterator like instance of either ProductContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ProductContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ expand_groups=expand_groups,
+ tags=tags,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, product_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the product specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, product_id: str, **kwargs: Any
+ ) -> _models.ProductContract:
+ """Gets the details of the product specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ProductContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ parameters: _models.ProductContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductContract:
+ """Creates or Updates a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductContract:
+ """Creates or Updates a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ parameters: Union[_models.ProductContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.ProductContract:
+ """Creates or Updates a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param parameters: Create or update parameters. Is either a ProductContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ProductContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ if_match: str,
+ parameters: _models.ProductUpdateParameters,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductContract:
+ """Update existing product details.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductUpdateParameters
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductContract:
+ """Update existing product details.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ if_match: str,
+ parameters: Union[_models.ProductUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ProductContract:
+ """Update existing product details.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a ProductUpdateParameters type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductUpdateParameters or IO[bytes]
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ProductContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ProductContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ if_match: str,
+ delete_subscriptions: Optional[bool] = None,
+ **kwargs: Any
+ ) -> None:
+ """Delete product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_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. Required.
+ :type if_match: str
+ :param delete_subscriptions: Delete existing subscriptions associated with the product or not.
+ Default value is None.
+ :type delete_subscriptions: bool
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ delete_subscriptions=delete_subscriptions,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_policy_operations.py
new file mode 100644
index 000000000000..fd70b459468d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_policy_operations.py
@@ -0,0 +1,544 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_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,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceProductPolicyOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_product_policy` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace_async
+ async def list_by_product(
+ self, resource_group_name: str, service_name: str, workspace_id: str, product_id: str, **kwargs: Any
+ ) -> _models.PolicyCollection:
+ """Get the policy configuration at the Product level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :return: PolicyCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None)
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyCollection", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ **kwargs: Any
+ ) -> bool:
+ """Get the ETag of the policy configuration at the Product level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Get the policy configuration at the Product level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is
+ "xml".
+ :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ format=format,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: _models.PolicyContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the Product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the Product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: Union[_models.PolicyContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the Product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the policy configuration at the Product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_subscription_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_subscription_operations.py
new file mode 100644
index 000000000000..f9b5b4c4b03c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_subscription_operations.py
@@ -0,0 +1,1003 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_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,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceSubscriptionOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_subscription` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.SubscriptionContract"]:
+ """Lists all subscriptions of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || productId | filter | ge, le, eq, ne, gt, lt | substringof, contains,
+ startswith, endswith || state | filter | eq | || user | expand | |
+ |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either SubscriptionContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.SubscriptionContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.SubscriptionCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, sid: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the apimanagement subscription specified by its
+ identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, sid: str, **kwargs: Any
+ ) -> _models.SubscriptionContract:
+ """Gets the specified Subscription entity.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.SubscriptionContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("SubscriptionContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ parameters: _models.SubscriptionCreateParameters,
+ notify: Optional[bool] = None,
+ if_match: Optional[str] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.SubscriptionContract:
+ """Creates or updates the subscription of specified user to the specified product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionCreateParameters
+ :param notify: Notify change in Subscription State.
+
+
+ * If false, do not send any email notification for change of state of subscription
+ * If true, send email notification of change of state of subscription. Default value is None.
+ :type notify: bool
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ parameters: IO[bytes],
+ notify: Optional[bool] = None,
+ if_match: Optional[str] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.SubscriptionContract:
+ """Creates or updates the subscription of specified user to the specified product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param notify: Notify change in Subscription State.
+
+
+ * If false, do not send any email notification for change of state of subscription
+ * If true, send email notification of change of state of subscription. Default value is None.
+ :type notify: bool
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ parameters: Union[_models.SubscriptionCreateParameters, IO[bytes]],
+ notify: Optional[bool] = None,
+ if_match: Optional[str] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ **kwargs: Any
+ ) -> _models.SubscriptionContract:
+ """Creates or updates the subscription of specified user to the specified product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :param parameters: Create parameters. Is either a SubscriptionCreateParameters type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionCreateParameters or IO[bytes]
+ :param notify: Notify change in Subscription State.
+
+
+ * If false, do not send any email notification for change of state of subscription
+ * If true, send email notification of change of state of subscription. Default value is None.
+ :type notify: bool
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.SubscriptionContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "SubscriptionCreateParameters")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ notify=notify,
+ if_match=if_match,
+ app_type=app_type,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ if_match: str,
+ parameters: _models.SubscriptionUpdateParameters,
+ notify: Optional[bool] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.SubscriptionContract:
+ """Updates the details of a subscription specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: 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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionUpdateParameters
+ :param notify: Notify change in Subscription State.
+
+
+ * If false, do not send any email notification for change of state of subscription
+ * If true, send email notification of change of state of subscription. Default value is None.
+ :type notify: bool
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ if_match: str,
+ parameters: IO[bytes],
+ notify: Optional[bool] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.SubscriptionContract:
+ """Updates the details of a subscription specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: 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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :param notify: Notify change in Subscription State.
+
+
+ * If false, do not send any email notification for change of state of subscription
+ * If true, send email notification of change of state of subscription. Default value is None.
+ :type notify: bool
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ if_match: str,
+ parameters: Union[_models.SubscriptionUpdateParameters, IO[bytes]],
+ notify: Optional[bool] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ **kwargs: Any
+ ) -> _models.SubscriptionContract:
+ """Updates the details of a subscription specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: 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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a SubscriptionUpdateParameters type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionUpdateParameters or IO[bytes]
+ :param notify: Notify change in Subscription State.
+
+
+ * If false, do not send any email notification for change of state of subscription
+ * If true, send email notification of change of state of subscription. Default value is None.
+ :type notify: bool
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.SubscriptionContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "SubscriptionUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ notify=notify,
+ app_type=app_type,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("SubscriptionContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, workspace_id: str, sid: str, if_match: str, **kwargs: Any
+ ) -> None:
+ """Deletes the specified subscription.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: 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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
+
+ @distributed_trace_async
+ async def regenerate_primary_key( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, workspace_id: str, sid: str, **kwargs: Any
+ ) -> None:
+ """Regenerates primary key of existing subscription of the workspace in an API Management service
+ instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_regenerate_primary_key_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+
+ @distributed_trace_async
+ async def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, workspace_id: str, sid: str, **kwargs: Any
+ ) -> None:
+ """Regenerates secondary key of existing subscription of the workspace in an API Management
+ service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_regenerate_secondary_key_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+
+ @distributed_trace_async
+ async def list_secrets(
+ self, resource_group_name: str, service_name: str, workspace_id: str, sid: str, **kwargs: Any
+ ) -> _models.SubscriptionKeysContract:
+ """Gets the specified Subscription keys.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :return: SubscriptionKeysContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionKeysContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.SubscriptionKeysContract] = kwargs.pop("cls", None)
+
+ _request = build_list_secrets_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("SubscriptionKeysContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_api_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_api_link_operations.py
new file mode 100644
index 000000000000..3ce987e59bfd
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_api_link_operations.py
@@ -0,0 +1,497 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_tag_api_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceTagApiLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_tag_api_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.TagApiLinkContract"]:
+ """Lists a collection of the API links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either TagApiLinkContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagApiLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagApiLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagApiLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Gets the API link for the tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagApiLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ parameters: _models.TagApiLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Adds an API to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Adds an API to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ parameters: Union[_models.TagApiLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Adds an API to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Is either a TagApiLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagApiLinkContract or IO[bytes]
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagApiLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagApiLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified API from the specified tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_operation_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_operation_link_operations.py
new file mode 100644
index 000000000000..be30993faebe
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_operation_link_operations.py
@@ -0,0 +1,498 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_tag_operation_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceTagOperationLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_tag_operation_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.TagOperationLinkContract"]:
+ """Lists a collection of the operation links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| operationId
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either TagOperationLinkContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagOperationLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagOperationLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagOperationLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Gets the operation link for the tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagOperationLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagOperationLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ parameters: _models.TagOperationLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Adds an operation to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Adds an operation to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ parameters: Union[_models.TagOperationLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Adds an operation to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :param parameters: Create or update parameters. Is either a TagOperationLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagOperationLinkContract or IO[bytes]
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagOperationLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagOperationLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified operation from the specified tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_operations.py
new file mode 100644
index 000000000000..1de8f6e28d71
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_operations.py
@@ -0,0 +1,724 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_tag_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_entity_state_request,
+ build_get_request,
+ build_list_by_service_request,
+ build_update_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceTagOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_tag` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ scope: Optional[str] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.TagContract"]:
+ """Lists a collection of tags defined within a workspace in a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param scope: Scope like 'apis', 'products' or 'apis/{apiId}. Default value is None.
+ :type scope: str
+ :return: An iterator like instance of either TagContract or the result of cls(response)
+ :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ scope=scope,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get_entity_state(
+ self, resource_group_name: str, service_name: str, workspace_id: str, tag_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state version of the tag specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_state_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, tag_id: str, **kwargs: Any
+ ) -> _models.TagContract:
+ """Gets the details of the tag specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ parameters: _models.TagCreateUpdateParameters,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagContract:
+ """Creates a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagContract:
+ """Creates a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ parameters: Union[_models.TagCreateUpdateParameters, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.TagContract:
+ """Creates a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param parameters: Create parameters. Is either a TagCreateUpdateParameters type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagCreateUpdateParameters")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ if_match: str,
+ parameters: _models.TagCreateUpdateParameters,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagContract:
+ """Updates the details of the tag specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagContract:
+ """Updates the details of the tag specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ if_match: str,
+ parameters: Union[_models.TagCreateUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.TagContract:
+ """Updates the details of the tag specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a TagCreateUpdateParameters type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO[bytes]
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagCreateUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, workspace_id: str, tag_id: str, if_match: str, **kwargs: Any
+ ) -> None:
+ """Deletes specific tag of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_product_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_product_link_operations.py
new file mode 100644
index 000000000000..9944464f358d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_product_link_operations.py
@@ -0,0 +1,498 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._workspace_tag_product_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceTagProductLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`workspace_tag_product_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> AsyncIterable["_models.TagProductLinkContract"]:
+ """Lists a collection of the product links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| productId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either TagProductLinkContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagProductLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagProductLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagProductLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Gets the product link for the tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagProductLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagProductLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ parameters: _models.TagProductLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Adds a product to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Adds a product to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ parameters: Union[_models.TagProductLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Adds a product to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :param parameters: Create or update parameters. Is either a TagProductLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagProductLinkContract or IO[bytes]
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagProductLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagProductLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified product from the specified tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # 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 87d143776a42..33200cf97849 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
@@ -12,6 +12,8 @@
from ._models_py3 import AccessInformationSecretsContract
from ._models_py3 import AccessInformationUpdateParameters
from ._models_py3 import AdditionalLocation
+from ._models_py3 import AllPoliciesCollection
+from ._models_py3 import AllPoliciesContract
from ._models_py3 import ApiCollection
from ._models_py3 import ApiContactInformation
from ._models_py3 import ApiContract
@@ -24,6 +26,16 @@
from ._models_py3 import ApiExportResult
from ._models_py3 import ApiExportResultValue
from ._models_py3 import ApiLicenseInformation
+from ._models_py3 import ApiManagementGatewayBaseProperties
+from ._models_py3 import ApiManagementGatewayConfigConnectionListResult
+from ._models_py3 import ApiManagementGatewayConfigConnectionResource
+from ._models_py3 import ApiManagementGatewayListResult
+from ._models_py3 import ApiManagementGatewayProperties
+from ._models_py3 import ApiManagementGatewayResource
+from ._models_py3 import ApiManagementGatewaySkuProperties
+from ._models_py3 import ApiManagementGatewaySkuPropertiesForPatch
+from ._models_py3 import ApiManagementGatewayUpdateParameters
+from ._models_py3 import ApiManagementGatewayUpdateProperties
from ._models_py3 import ApiManagementServiceApplyNetworkConfigurationParameters
from ._models_py3 import ApiManagementServiceBackupRestoreParameters
from ._models_py3 import ApiManagementServiceBaseProperties
@@ -47,6 +59,9 @@
from ._models_py3 import ApiManagementSkuRestrictions
from ._models_py3 import ApiManagementSkuZoneDetails
from ._models_py3 import ApiManagementSkusResult
+from ._models_py3 import ApiManagementWorkspaceLinksListResult
+from ._models_py3 import ApiManagementWorkspaceLinksProperties
+from ._models_py3 import ApiManagementWorkspaceLinksResource
from ._models_py3 import ApiReleaseCollection
from ._models_py3 import ApiReleaseContract
from ._models_py3 import ApiRevisionCollection
@@ -87,14 +102,20 @@
from ._models_py3 import AuthorizationServerUpdateContractProperties
from ._models_py3 import BackendAuthorizationHeaderCredentials
from ._models_py3 import BackendBaseParameters
+from ._models_py3 import BackendBaseParametersPool
+from ._models_py3 import BackendCircuitBreaker
from ._models_py3 import BackendCollection
+from ._models_py3 import BackendConfiguration
from ._models_py3 import BackendContract
from ._models_py3 import BackendContractProperties
from ._models_py3 import BackendCredentialsContract
+from ._models_py3 import BackendPool
+from ._models_py3 import BackendPoolItem
from ._models_py3 import BackendProperties
from ._models_py3 import BackendProxyContract
from ._models_py3 import BackendReconnectContract
from ._models_py3 import BackendServiceFabricClusterProperties
+from ._models_py3 import BackendSubnetConfiguration
from ._models_py3 import BackendTlsProperties
from ._models_py3 import BackendUpdateParameterProperties
from ._models_py3 import BackendUpdateParameters
@@ -107,7 +128,10 @@
from ._models_py3 import CertificateContract
from ._models_py3 import CertificateCreateOrUpdateParameters
from ._models_py3 import CertificateInformation
+from ._models_py3 import CircuitBreakerFailureCondition
+from ._models_py3 import CircuitBreakerRule
from ._models_py3 import ClientSecretContract
+from ._models_py3 import ConfigurationApi
from ._models_py3 import ConnectivityCheckRequest
from ._models_py3 import ConnectivityCheckRequestDestination
from ._models_py3 import ConnectivityCheckRequestProtocolConfiguration
@@ -128,6 +152,7 @@
from ._models_py3 import DeployConfigurationParameters
from ._models_py3 import DiagnosticCollection
from ._models_py3 import DiagnosticContract
+from ._models_py3 import DiagnosticUpdateContract
from ._models_py3 import DocumentationCollection
from ._models_py3 import DocumentationContract
from ._models_py3 import DocumentationUpdateContract
@@ -137,17 +162,29 @@
from ._models_py3 import EmailTemplateUpdateParameters
from ._models_py3 import EndpointDependency
from ._models_py3 import EndpointDetail
+from ._models_py3 import ErrorAdditionalInfo
+from ._models_py3 import ErrorDetail
from ._models_py3 import ErrorFieldContract
from ._models_py3 import ErrorResponse
from ._models_py3 import ErrorResponseBody
+from ._models_py3 import FailureStatusCodeRange
+from ._models_py3 import FrontendConfiguration
from ._models_py3 import GatewayCertificateAuthorityCollection
from ._models_py3 import GatewayCertificateAuthorityContract
from ._models_py3 import GatewayCollection
+from ._models_py3 import GatewayConfigurationApi
from ._models_py3 import GatewayContract
+from ._models_py3 import GatewayDebugCredentialsContract
from ._models_py3 import GatewayHostnameConfigurationCollection
from ._models_py3 import GatewayHostnameConfigurationContract
from ._models_py3 import GatewayKeyRegenerationRequestContract
from ._models_py3 import GatewayKeysContract
+from ._models_py3 import GatewayListDebugCredentialsContract
+from ._models_py3 import GatewayListTraceContract
+from ._models_py3 import GatewayResourceSkuResult
+from ._models_py3 import GatewayResourceSkuResults
+from ._models_py3 import GatewaySku
+from ._models_py3 import GatewaySkuCapacity
from ._models_py3 import GatewayTokenContract
from ._models_py3 import GatewayTokenRequestContract
from ._models_py3 import GenerateSsoUrlResult
@@ -182,9 +219,12 @@
from ._models_py3 import KeyVaultContractCreateProperties
from ._models_py3 import KeyVaultContractProperties
from ._models_py3 import KeyVaultLastAccessStatusContractProperties
+from ._models_py3 import LLMDiagnosticSettings
+from ._models_py3 import LLMMessageDiagnosticSettings
from ._models_py3 import LoggerCollection
from ._models_py3 import LoggerContract
from ._models_py3 import LoggerUpdateContract
+from ._models_py3 import MigrateToStv2Contract
from ._models_py3 import NamedValueCollection
from ._models_py3 import NamedValueContract
from ._models_py3 import NamedValueContractProperties
@@ -212,6 +252,7 @@
from ._models_py3 import OperationListResult
from ._models_py3 import OperationResultContract
from ._models_py3 import OperationResultLogItemContract
+from ._models_py3 import OperationStatusResult
from ._models_py3 import OperationTagResourceContractProperties
from ._models_py3 import OperationUpdateContract
from ._models_py3 import OperationUpdateContractProperties
@@ -226,6 +267,11 @@
from ._models_py3 import PolicyDescriptionContract
from ._models_py3 import PolicyFragmentCollection
from ._models_py3 import PolicyFragmentContract
+from ._models_py3 import PolicyRestrictionCollection
+from ._models_py3 import PolicyRestrictionContract
+from ._models_py3 import PolicyRestrictionUpdateContract
+from ._models_py3 import PolicyWithComplianceCollection
+from ._models_py3 import PolicyWithComplianceContract
from ._models_py3 import PortalConfigCollection
from ._models_py3 import PortalConfigContract
from ._models_py3 import PortalConfigCorsProperties
@@ -250,10 +296,14 @@
from ._models_py3 import PrivateLinkResource
from ._models_py3 import PrivateLinkResourceListResult
from ._models_py3 import PrivateLinkServiceConnectionState
+from ._models_py3 import ProductApiLinkCollection
+from ._models_py3 import ProductApiLinkContract
from ._models_py3 import ProductCollection
from ._models_py3 import ProductContract
from ._models_py3 import ProductContractProperties
from ._models_py3 import ProductEntityBaseParameters
+from ._models_py3 import ProductGroupLinkCollection
+from ._models_py3 import ProductGroupLinkContract
from ._models_py3 import ProductTagResourceContractProperties
from ._models_py3 import ProductUpdateParameters
from ._models_py3 import ProductUpdateProperties
@@ -304,6 +354,8 @@
from ._models_py3 import SubscriptionUpdateParameters
from ._models_py3 import SubscriptionsDelegationSettingsProperties
from ._models_py3 import SystemData
+from ._models_py3 import TagApiLinkCollection
+from ._models_py3 import TagApiLinkContract
from ._models_py3 import TagCollection
from ._models_py3 import TagContract
from ._models_py3 import TagCreateUpdateParameters
@@ -312,6 +364,10 @@
from ._models_py3 import TagDescriptionContract
from ._models_py3 import TagDescriptionContractProperties
from ._models_py3 import TagDescriptionCreateParameters
+from ._models_py3 import TagOperationLinkCollection
+from ._models_py3 import TagOperationLinkContract
+from ._models_py3 import TagProductLinkCollection
+from ._models_py3 import TagProductLinkContract
from ._models_py3 import TagResourceCollection
from ._models_py3 import TagResourceContract
from ._models_py3 import TagResourceContractProperties
@@ -338,11 +394,16 @@
from ._models_py3 import WikiContract
from ._models_py3 import WikiDocumentationContract
from ._models_py3 import WikiUpdateContract
+from ._models_py3 import WorkspaceCollection
+from ._models_py3 import WorkspaceContract
+from ._models_py3 import WorkspaceLinksBaseProperties
+from ._models_py3 import WorkspaceLinksGateway
from ._models_py3 import X509CertificateName
from ._api_management_client_enums import AccessIdName
from ._api_management_client_enums import AccessType
from ._api_management_client_enums import AlwaysLog
+from ._api_management_client_enums import ApiGatewaySkuType
from ._api_management_client_enums import ApiManagementSkuCapacityScaleType
from ._api_management_client_enums import ApiManagementSkuRestrictionsReasonCode
from ._api_management_client_enums import ApiManagementSkuRestrictionsType
@@ -354,6 +415,7 @@
from ._api_management_client_enums import AuthorizationMethod
from ._api_management_client_enums import AuthorizationType
from ._api_management_client_enums import BackendProtocol
+from ._api_management_client_enums import BackendType
from ._api_management_client_enums import BearerTokenSendingMethod
from ._api_management_client_enums import BearerTokenSendingMethods
from ._api_management_client_enums import CertificateConfigurationStoreName
@@ -368,9 +430,12 @@
from ._api_management_client_enums import ContentFormat
from ._api_management_client_enums import CreatedByType
from ._api_management_client_enums import DataMaskingMode
+from ._api_management_client_enums import DeveloperPortalStatus
from ._api_management_client_enums import ExportApi
from ._api_management_client_enums import ExportFormat
from ._api_management_client_enums import ExportResultFormat
+from ._api_management_client_enums import GatewayListDebugCredentialsContractPurpose
+from ._api_management_client_enums import GatewaySkuCapacityScaleType
from ._api_management_client_enums import GrantType
from ._api_management_client_enums import GroupType
from ._api_management_client_enums import HostnameType
@@ -378,8 +443,14 @@
from ._api_management_client_enums import IdentityProviderType
from ._api_management_client_enums import IssueType
from ._api_management_client_enums import KeyType
+from ._api_management_client_enums import KeyVaultRefreshState
+from ._api_management_client_enums import LegacyApiState
+from ._api_management_client_enums import LegacyPortalStatus
+from ._api_management_client_enums import LlmDiagnosticSettings
+from ._api_management_client_enums import LlmMessageLogTypes
from ._api_management_client_enums import LoggerType
from ._api_management_client_enums import Method
+from ._api_management_client_enums import MigrateToStv2Mode
from ._api_management_client_enums import NameAvailabilityReason
from ._api_management_client_enums import NatGatewayState
from ._api_management_client_enums import NotificationName
@@ -387,10 +458,12 @@
from ._api_management_client_enums import OperationNameFormat
from ._api_management_client_enums import Origin
from ._api_management_client_enums import PlatformVersion
+from ._api_management_client_enums import PolicyComplianceState
from ._api_management_client_enums import PolicyContentFormat
from ._api_management_client_enums import PolicyExportFormat
from ._api_management_client_enums import PolicyFragmentContentFormat
from ._api_management_client_enums import PolicyIdName
+from ._api_management_client_enums import PolicyRestrictionRequireBase
from ._api_management_client_enums import PolicyScopeContract
from ._api_management_client_enums import PortalRevisionStatus
from ._api_management_client_enums import PortalSettingsCspMode
@@ -400,6 +473,7 @@
from ._api_management_client_enums import ProductState
from ._api_management_client_enums import Protocol
from ._api_management_client_enums import PublicNetworkAccess
+from ._api_management_client_enums import ReleaseChannel
from ._api_management_client_enums import ResourceSkuCapacityScaleType
from ._api_management_client_enums import SamplingType
from ._api_management_client_enums import SchemaType
@@ -426,6 +500,8 @@
"AccessInformationSecretsContract",
"AccessInformationUpdateParameters",
"AdditionalLocation",
+ "AllPoliciesCollection",
+ "AllPoliciesContract",
"ApiCollection",
"ApiContactInformation",
"ApiContract",
@@ -438,6 +514,16 @@
"ApiExportResult",
"ApiExportResultValue",
"ApiLicenseInformation",
+ "ApiManagementGatewayBaseProperties",
+ "ApiManagementGatewayConfigConnectionListResult",
+ "ApiManagementGatewayConfigConnectionResource",
+ "ApiManagementGatewayListResult",
+ "ApiManagementGatewayProperties",
+ "ApiManagementGatewayResource",
+ "ApiManagementGatewaySkuProperties",
+ "ApiManagementGatewaySkuPropertiesForPatch",
+ "ApiManagementGatewayUpdateParameters",
+ "ApiManagementGatewayUpdateProperties",
"ApiManagementServiceApplyNetworkConfigurationParameters",
"ApiManagementServiceBackupRestoreParameters",
"ApiManagementServiceBaseProperties",
@@ -461,6 +547,9 @@
"ApiManagementSkuRestrictions",
"ApiManagementSkuZoneDetails",
"ApiManagementSkusResult",
+ "ApiManagementWorkspaceLinksListResult",
+ "ApiManagementWorkspaceLinksProperties",
+ "ApiManagementWorkspaceLinksResource",
"ApiReleaseCollection",
"ApiReleaseContract",
"ApiRevisionCollection",
@@ -501,14 +590,20 @@
"AuthorizationServerUpdateContractProperties",
"BackendAuthorizationHeaderCredentials",
"BackendBaseParameters",
+ "BackendBaseParametersPool",
+ "BackendCircuitBreaker",
"BackendCollection",
+ "BackendConfiguration",
"BackendContract",
"BackendContractProperties",
"BackendCredentialsContract",
+ "BackendPool",
+ "BackendPoolItem",
"BackendProperties",
"BackendProxyContract",
"BackendReconnectContract",
"BackendServiceFabricClusterProperties",
+ "BackendSubnetConfiguration",
"BackendTlsProperties",
"BackendUpdateParameterProperties",
"BackendUpdateParameters",
@@ -521,7 +616,10 @@
"CertificateContract",
"CertificateCreateOrUpdateParameters",
"CertificateInformation",
+ "CircuitBreakerFailureCondition",
+ "CircuitBreakerRule",
"ClientSecretContract",
+ "ConfigurationApi",
"ConnectivityCheckRequest",
"ConnectivityCheckRequestDestination",
"ConnectivityCheckRequestProtocolConfiguration",
@@ -542,6 +640,7 @@
"DeployConfigurationParameters",
"DiagnosticCollection",
"DiagnosticContract",
+ "DiagnosticUpdateContract",
"DocumentationCollection",
"DocumentationContract",
"DocumentationUpdateContract",
@@ -551,17 +650,29 @@
"EmailTemplateUpdateParameters",
"EndpointDependency",
"EndpointDetail",
+ "ErrorAdditionalInfo",
+ "ErrorDetail",
"ErrorFieldContract",
"ErrorResponse",
"ErrorResponseBody",
+ "FailureStatusCodeRange",
+ "FrontendConfiguration",
"GatewayCertificateAuthorityCollection",
"GatewayCertificateAuthorityContract",
"GatewayCollection",
+ "GatewayConfigurationApi",
"GatewayContract",
+ "GatewayDebugCredentialsContract",
"GatewayHostnameConfigurationCollection",
"GatewayHostnameConfigurationContract",
"GatewayKeyRegenerationRequestContract",
"GatewayKeysContract",
+ "GatewayListDebugCredentialsContract",
+ "GatewayListTraceContract",
+ "GatewayResourceSkuResult",
+ "GatewayResourceSkuResults",
+ "GatewaySku",
+ "GatewaySkuCapacity",
"GatewayTokenContract",
"GatewayTokenRequestContract",
"GenerateSsoUrlResult",
@@ -596,9 +707,12 @@
"KeyVaultContractCreateProperties",
"KeyVaultContractProperties",
"KeyVaultLastAccessStatusContractProperties",
+ "LLMDiagnosticSettings",
+ "LLMMessageDiagnosticSettings",
"LoggerCollection",
"LoggerContract",
"LoggerUpdateContract",
+ "MigrateToStv2Contract",
"NamedValueCollection",
"NamedValueContract",
"NamedValueContractProperties",
@@ -626,6 +740,7 @@
"OperationListResult",
"OperationResultContract",
"OperationResultLogItemContract",
+ "OperationStatusResult",
"OperationTagResourceContractProperties",
"OperationUpdateContract",
"OperationUpdateContractProperties",
@@ -640,6 +755,11 @@
"PolicyDescriptionContract",
"PolicyFragmentCollection",
"PolicyFragmentContract",
+ "PolicyRestrictionCollection",
+ "PolicyRestrictionContract",
+ "PolicyRestrictionUpdateContract",
+ "PolicyWithComplianceCollection",
+ "PolicyWithComplianceContract",
"PortalConfigCollection",
"PortalConfigContract",
"PortalConfigCorsProperties",
@@ -664,10 +784,14 @@
"PrivateLinkResource",
"PrivateLinkResourceListResult",
"PrivateLinkServiceConnectionState",
+ "ProductApiLinkCollection",
+ "ProductApiLinkContract",
"ProductCollection",
"ProductContract",
"ProductContractProperties",
"ProductEntityBaseParameters",
+ "ProductGroupLinkCollection",
+ "ProductGroupLinkContract",
"ProductTagResourceContractProperties",
"ProductUpdateParameters",
"ProductUpdateProperties",
@@ -718,6 +842,8 @@
"SubscriptionUpdateParameters",
"SubscriptionsDelegationSettingsProperties",
"SystemData",
+ "TagApiLinkCollection",
+ "TagApiLinkContract",
"TagCollection",
"TagContract",
"TagCreateUpdateParameters",
@@ -726,6 +852,10 @@
"TagDescriptionContract",
"TagDescriptionContractProperties",
"TagDescriptionCreateParameters",
+ "TagOperationLinkCollection",
+ "TagOperationLinkContract",
+ "TagProductLinkCollection",
+ "TagProductLinkContract",
"TagResourceCollection",
"TagResourceContract",
"TagResourceContractProperties",
@@ -752,10 +882,15 @@
"WikiContract",
"WikiDocumentationContract",
"WikiUpdateContract",
+ "WorkspaceCollection",
+ "WorkspaceContract",
+ "WorkspaceLinksBaseProperties",
+ "WorkspaceLinksGateway",
"X509CertificateName",
"AccessIdName",
"AccessType",
"AlwaysLog",
+ "ApiGatewaySkuType",
"ApiManagementSkuCapacityScaleType",
"ApiManagementSkuRestrictionsReasonCode",
"ApiManagementSkuRestrictionsType",
@@ -767,6 +902,7 @@
"AuthorizationMethod",
"AuthorizationType",
"BackendProtocol",
+ "BackendType",
"BearerTokenSendingMethod",
"BearerTokenSendingMethods",
"CertificateConfigurationStoreName",
@@ -781,9 +917,12 @@
"ContentFormat",
"CreatedByType",
"DataMaskingMode",
+ "DeveloperPortalStatus",
"ExportApi",
"ExportFormat",
"ExportResultFormat",
+ "GatewayListDebugCredentialsContractPurpose",
+ "GatewaySkuCapacityScaleType",
"GrantType",
"GroupType",
"HostnameType",
@@ -791,8 +930,14 @@
"IdentityProviderType",
"IssueType",
"KeyType",
+ "KeyVaultRefreshState",
+ "LegacyApiState",
+ "LegacyPortalStatus",
+ "LlmDiagnosticSettings",
+ "LlmMessageLogTypes",
"LoggerType",
"Method",
+ "MigrateToStv2Mode",
"NameAvailabilityReason",
"NatGatewayState",
"NotificationName",
@@ -800,10 +945,12 @@
"OperationNameFormat",
"Origin",
"PlatformVersion",
+ "PolicyComplianceState",
"PolicyContentFormat",
"PolicyExportFormat",
"PolicyFragmentContentFormat",
"PolicyIdName",
+ "PolicyRestrictionRequireBase",
"PolicyScopeContract",
"PortalRevisionStatus",
"PortalSettingsCspMode",
@@ -813,6 +960,7 @@
"ProductState",
"Protocol",
"PublicNetworkAccess",
+ "ReleaseChannel",
"ResourceSkuCapacityScaleType",
"SamplingType",
"SchemaType",
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 01c8f0ff131a..a13638923230 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
@@ -35,6 +35,17 @@ class AlwaysLog(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Always log all erroneous request regardless of sampling settings."""
+class ApiGatewaySkuType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Name of the Sku."""
+
+ STANDARD = "Standard"
+ """Standard SKU of the API gateway."""
+ WORKSPACE_GATEWAY_STANDARD = "WorkspaceGatewayStandard"
+ """Standard SKU of the API gateway to be used in Workspaces."""
+ WORKSPACE_GATEWAY_PREMIUM = "WorkspaceGatewayPremium"
+ """Premium SKU of the API gateway to be used in Workspaces."""
+
+
class ApiManagementSkuCapacityScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The scale type applicable to the sku."""
@@ -76,6 +87,8 @@ class ApiType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
SOAP = "soap"
WEBSOCKET = "websocket"
GRAPHQL = "graphql"
+ ODATA = "odata"
+ GRPC = "grpc"
class AppType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@@ -134,6 +147,15 @@ class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The Backend is a SOAP service."""
+class BackendType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Type of the backend. A backend can be either Single or Pool."""
+
+ SINGLE = "Single"
+ """supports single backend"""
+ POOL = "Pool"
+ """supports pool backend"""
+
+
class BearerTokenSendingMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""BearerTokenSendingMethod."""
@@ -228,7 +250,9 @@ class ConnectivityStatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
class ContentFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta):
- """Format of the Content in which the API is getting imported."""
+ """Format of the Content in which the API is getting imported. New formats can be added in the
+ future.
+ """
WADL_XML = "wadl-xml"
"""The contents are inline and Content type is a WADL document."""
@@ -252,6 +276,14 @@ class ContentFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The OpenAPI 3.0 JSON document is hosted on a publicly accessible internet address."""
GRAPHQL_LINK = "graphql-link"
"""The GraphQL API endpoint hosted on a publicly accessible internet address."""
+ ODATA = "odata"
+ """The contents are inline and Content Type is a OData XML Document."""
+ ODATA_LINK = "odata-link"
+ """The OData metadata document hosted on a publicly accessible internet address."""
+ GRPC = "grpc"
+ """The contents are inline and Content Type is a gRPC protobuf file."""
+ GRPC_LINK = "grpc-link"
+ """The gRPC protobuf file is hosted on a publicly accessible internet address."""
class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@@ -272,6 +304,15 @@ class DataMaskingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Hide the presence of an entity."""
+class DeveloperPortalStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Status of developer portal in this API Management service."""
+
+ ENABLED = "Enabled"
+ """Developer Portal is enabled for the service."""
+ DISABLED = "Disabled"
+ """Developer Portal is disabled for the service."""
+
+
class ExportApi(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""ExportApi."""
@@ -310,6 +351,24 @@ class ExportResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Export the API Definition in OpenAPI Specification 3.0 to Storage Blob."""
+class GatewayListDebugCredentialsContractPurpose(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Purpose of debug credential."""
+
+ TRACING = "tracing"
+ """The tracing purpose."""
+
+
+class GatewaySkuCapacityScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """The scale type applicable to the sku."""
+
+ AUTOMATIC = "Automatic"
+ """Supported scale type automatic."""
+ MANUAL = "Manual"
+ """Supported scale type manual."""
+ NONE = "None"
+ """Scaling not supported."""
+
+
class GrantType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""GrantType."""
@@ -340,6 +399,7 @@ class HostnameType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
MANAGEMENT = "Management"
SCM = "Scm"
DEVELOPER_PORTAL = "DeveloperPortal"
+ CONFIGURATION_API = "ConfigurationApi"
class HttpCorrelationProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@@ -392,6 +452,55 @@ class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
SECONDARY = "secondary"
+class KeyVaultRefreshState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """KeyVaultRefreshState."""
+
+ TRUE = "true"
+ """Entities for which KeyVault refresh failed."""
+ FALSE = "false"
+ """Entities for which KeyVault refresh succeeded"""
+
+
+class LegacyApiState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Indication whether or not the legacy Configuration API (v1) should be exposed on the API
+ Management service. Value is optional but must be 'Enabled' or 'Disabled'. If 'Disabled',
+ legacy Configuration API (v1) will not be available for self-hosted gateways. Default value is
+ 'Enabled'.
+ """
+
+ ENABLED = "Enabled"
+ """Legacy Configuration API (v1) is enabled for the service and self-hosted gateways can connect
+ to it."""
+ DISABLED = "Disabled"
+ """Legacy Configuration API (v1) is disabled for the service and self-hosted gateways can not
+ connect to it."""
+
+
+class LegacyPortalStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Status of legacy portal in the API Management service."""
+
+ ENABLED = "Enabled"
+ """Legacy Portal is enabled for the service."""
+ DISABLED = "Disabled"
+ """Legacy Portal is disabled for the service."""
+
+
+class LlmDiagnosticSettings(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """LlmDiagnosticSettings."""
+
+ ENABLED = "enabled"
+ """Default LLM logs are enabled."""
+ DISABLED = "disabled"
+ """Default LLM logs are disabled."""
+
+
+class LlmMessageLogTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """LlmMessageLogTypes."""
+
+ ALL = "all"
+ """Log all messages."""
+
+
class LoggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Logger type."""
@@ -410,6 +519,18 @@ class Method(str, Enum, metaclass=CaseInsensitiveEnumMeta):
POST = "POST"
+class MigrateToStv2Mode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Mode of Migration to stv2. Default is PreserveIp."""
+
+ PRESERVE_IP = "PreserveIp"
+ """Migrate API Management service to stv2 from stv1, by reserving the IP Address of the service.
+ This will have a downtime of upto 15 minutes, while the IP address is getting migrate to new
+ infrastructure."""
+ NEW_IP = "NewIP"
+ """Migrate API Management service to stv2 from stv1. This will have no downtime as the service
+ configuration will be migrated to new infrastructure, but the IP address will changed."""
+
+
class NameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""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
@@ -492,6 +613,19 @@ class PlatformVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Platform running the service on Single Tenant V2 platform."""
MTV1 = "mtv1"
"""Platform running the service on Multi Tenant V1 platform."""
+ STV2_1 = "stv2.1"
+ """Platform running the service on Single Tenant V2 platform on newer Hardware."""
+
+
+class PolicyComplianceState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Policy Restriction Compliance State."""
+
+ PENDING = "Pending"
+ """The policy restriction compliance state has not yet been determined."""
+ NON_COMPLIANT = "NonCompliant"
+ """The scope in restriction is out of compliance."""
+ COMPLIANT = "Compliant"
+ """The scope in restriction is in compliance."""
class PolicyContentFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@@ -533,6 +667,15 @@ class PolicyIdName(str, Enum, metaclass=CaseInsensitiveEnumMeta):
POLICY = "policy"
+class PolicyRestrictionRequireBase(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Indicates if base policy should be enforced for the policy document."""
+
+ TRUE = "true"
+ """The policy is required to have base policy"""
+ FALSE = "false"
+ """The policy does not require to have base policy"""
+
+
class PolicyScopeContract(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""PolicyScopeContract."""
@@ -619,6 +762,17 @@ class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta):
DISABLED = "Disabled"
+class ReleaseChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Release Channel of this API Management service."""
+
+ PREVIEW = "Preview"
+ """Preview Channel of the service."""
+ DEFAULT = "Default"
+ """Default Channel of the service."""
+ STABLE = "Stable"
+ """Stable Channel of the service."""
+
+
class ResourceSkuCapacityScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The scale type applicable to the sku."""
@@ -674,6 +828,10 @@ class SkuType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Consumption SKU of Api Management."""
ISOLATED = "Isolated"
"""Isolated SKU of Api Management."""
+ BASIC_V2 = "BasicV2"
+ """BasicV2 SKU of Api Management."""
+ STANDARD_V2 = "StandardV2"
+ """StandardV2 SKU of Api Management."""
class SoapApiType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@@ -684,6 +842,7 @@ class SoapApiType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
* ``soap`` creates a SOAP pass-through API
* ``websocket`` creates websocket API
* ``graphql`` creates GraphQL API.
+ New types can be added in the future.
"""
SOAP_TO_REST = "http"
@@ -694,6 +853,10 @@ class SoapApiType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Imports the API having a Websocket front end."""
GRAPH_QL = "graphql"
"""Imports the API having a GraphQL front end."""
+ O_DATA = "odata"
+ """Imports the API having a OData front end."""
+ G_RPC = "grpc"
+ """Imports the API having a gRPC front end."""
class State(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@@ -799,17 +962,12 @@ class VersioningScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta):
class VirtualNetworkType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
- """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.
- """
+ """The type of VPN in which API Management gateway needs to be configured in."""
NONE = "None"
- """The service is not part of any Virtual Network."""
+ """The API Management gateway is not part of any Virtual Network."""
EXTERNAL = "External"
- """The service is part of Virtual Network and it is accessible from Internet."""
+ """The API Management gateway is part of Virtual Network and it is accessible from Internet."""
INTERNAL = "Internal"
- """The service is part of Virtual Network and it is only accessible from within the virtual
- network."""
+ """The API Management gateway is part of Virtual Network and it is only accessible from within the
+ virtual network."""
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 6c4770ae7729..a0d1b6a06d2c 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
@@ -337,7 +337,7 @@ class AdditionalLocation(_serialization.Model): # pylint: disable=too-many-inst
locations. This can be used to disable the gateway in this additional location.
:vartype disable_gateway: bool
:ivar platform_version: Compute Platform Version running the service. Known values are:
- "undetermined", "stv1", "stv2", and "mtv1".
+ "undetermined", "stv1", "stv2", "mtv1", and "stv2.1".
:vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion
"""
@@ -415,6 +415,91 @@ def __init__(
self.platform_version = None
+class AllPoliciesCollection(_serialization.Model):
+ """The response of All Policies.
+
+ :ivar value: AllPolicies Contract value.
+ :vartype value: list[~azure.mgmt.apimanagement.models.AllPoliciesContract]
+ :ivar next_link: Next page link if any.
+ :vartype next_link: str
+ """
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[AllPoliciesContract]"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: Optional[List["_models.AllPoliciesContract"]] = None,
+ next_link: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: AllPolicies Contract value.
+ :paramtype value: list[~azure.mgmt.apimanagement.models.AllPoliciesContract]
+ :keyword next_link: Next page link if any.
+ :paramtype next_link: str
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.next_link = next_link
+
+
+class AllPoliciesContract(ProxyResource):
+ """AllPolicies 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}. # pylint: disable=line-too-long
+ :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 reference_policy_id: Policy Identifier.
+ :vartype reference_policy_id: str
+ :ivar compliance_state: Policy Restriction Compliance State. Known values are: "Pending",
+ "NonCompliant", and "Compliant".
+ :vartype compliance_state: str or ~azure.mgmt.apimanagement.models.PolicyComplianceState
+ """
+
+ _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"},
+ "reference_policy_id": {"key": "properties.referencePolicyId", "type": "str"},
+ "compliance_state": {"key": "properties.complianceState", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ reference_policy_id: Optional[str] = None,
+ compliance_state: Optional[Union[str, "_models.PolicyComplianceState"]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword reference_policy_id: Policy Identifier.
+ :paramtype reference_policy_id: str
+ :keyword compliance_state: Policy Restriction Compliance State. Known values are: "Pending",
+ "NonCompliant", and "Compliant".
+ :paramtype compliance_state: str or ~azure.mgmt.apimanagement.models.PolicyComplianceState
+ """
+ super().__init__(**kwargs)
+ self.reference_policy_id = reference_policy_id
+ self.compliance_state = compliance_state
+
+
class ApiCollection(_serialization.Model):
"""Paged API list representation.
@@ -507,7 +592,8 @@ class ApiContract(ProxyResource): # pylint: disable=too-many-instance-attribute
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
: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.
@@ -549,6 +635,8 @@ class ApiContract(ProxyResource): # pylint: disable=too-many-instance-attribute
: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 provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
"""
_validation = {
@@ -563,6 +651,7 @@ class ApiContract(ProxyResource): # pylint: disable=too-many-instance-attribute
"display_name": {"max_length": 300, "min_length": 1},
"service_url": {"max_length": 2000},
"path": {"max_length": 400},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -596,6 +685,7 @@ class ApiContract(ProxyResource): # pylint: disable=too-many-instance-attribute
"path": {"key": "properties.path", "type": "str"},
"protocols": {"key": "properties.protocols", "type": "[str]"},
"api_version_set": {"key": "properties.apiVersionSet", "type": "ApiVersionSetContractDetails"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
}
def __init__( # pylint: disable=too-many-locals
@@ -632,7 +722,8 @@ def __init__( # pylint: disable=too-many-locals
: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. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
: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.
@@ -695,6 +786,7 @@ def __init__( # pylint: disable=too-many-locals
self.path = path
self.protocols = protocols
self.api_version_set = api_version_set
+ self.provisioning_state = None
class ApiEntityBaseContract(_serialization.Model): # pylint: disable=too-many-instance-attributes
@@ -710,7 +802,8 @@ class ApiEntityBaseContract(_serialization.Model): # pylint: disable=too-many-i
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
: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.
@@ -796,7 +889,8 @@ def __init__(
: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. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
: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.
@@ -855,7 +949,8 @@ class ApiContractProperties(ApiEntityBaseContract): # pylint: disable=too-many-
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
: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.
@@ -897,6 +992,8 @@ class ApiContractProperties(ApiEntityBaseContract): # pylint: disable=too-many-
: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 provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
"""
_validation = {
@@ -908,6 +1005,7 @@ class ApiContractProperties(ApiEntityBaseContract): # pylint: disable=too-many-
"display_name": {"max_length": 300, "min_length": 1},
"service_url": {"max_length": 2000},
"path": {"required": True, "max_length": 400},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -935,6 +1033,7 @@ class ApiContractProperties(ApiEntityBaseContract): # pylint: disable=too-many-
"path": {"key": "path", "type": "str"},
"protocols": {"key": "protocols", "type": "[str]"},
"api_version_set": {"key": "apiVersionSet", "type": "ApiVersionSetContractDetails"},
+ "provisioning_state": {"key": "provisioningState", "type": "str"},
}
def __init__(
@@ -971,7 +1070,8 @@ def __init__(
: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. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
: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.
@@ -1035,6 +1135,7 @@ def __init__(
self.path = path
self.protocols = protocols
self.api_version_set = api_version_set
+ self.provisioning_state = None
class ApiContractUpdateProperties(ApiEntityBaseContract): # pylint: disable=too-many-instance-attributes
@@ -1050,7 +1151,8 @@ class ApiContractUpdateProperties(ApiEntityBaseContract): # pylint: disable=too
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
: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.
@@ -1157,7 +1259,8 @@ def __init__(
: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. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
: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.
@@ -1229,7 +1332,8 @@ class ApiCreateOrUpdateParameter(_serialization.Model): # pylint: disable=too-m
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
: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.
@@ -1271,11 +1375,14 @@ class ApiCreateOrUpdateParameter(_serialization.Model): # pylint: disable=too-m
: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 provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
:ivar value: Content value when Importing an API.
:vartype value: str
- :ivar format: Format of the Content in which the API is getting imported. Known values are:
- "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", "wsdl-link",
- "openapi", "openapi+json", "openapi-link", "openapi+json-link", and "graphql-link".
+ :ivar format: Format of the Content in which the API is getting imported. New formats can be
+ added in the future. Known values are: "wadl-xml", "wadl-link-json", "swagger-json",
+ "swagger-link-json", "wsdl", "wsdl-link", "openapi", "openapi+json", "openapi-link",
+ "openapi+json-link", "graphql-link", "odata", "odata-link", "grpc", and "grpc-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:
@@ -1286,8 +1393,9 @@ class ApiCreateOrUpdateParameter(_serialization.Model): # pylint: disable=too-m
* ``http`` creates a REST API
* ``soap`` creates a SOAP pass-through API
* ``websocket`` creates websocket API
- * ``graphql`` creates GraphQL API. Known values are: "http", "soap", "websocket", and
- "graphql".
+ * ``graphql`` creates GraphQL API.
+ New types can be added in the future. Known values are: "http", "soap", "websocket",
+ "graphql", "odata", and "grpc".
:vartype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType
:ivar translate_required_query_parameters_conduct: Strategy of translating required query
parameters to template ones. By default has value 'template'. Possible values: 'template',
@@ -1305,6 +1413,7 @@ class ApiCreateOrUpdateParameter(_serialization.Model): # pylint: disable=too-m
"display_name": {"max_length": 300, "min_length": 1},
"service_url": {"max_length": 2000},
"path": {"max_length": 400},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -1335,6 +1444,7 @@ class ApiCreateOrUpdateParameter(_serialization.Model): # pylint: disable=too-m
"path": {"key": "properties.path", "type": "str"},
"protocols": {"key": "properties.protocols", "type": "[str]"},
"api_version_set": {"key": "properties.apiVersionSet", "type": "ApiVersionSetContractDetails"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"value": {"key": "properties.value", "type": "str"},
"format": {"key": "properties.format", "type": "str"},
"wsdl_selector": {"key": "properties.wsdlSelector", "type": "ApiCreateOrUpdatePropertiesWsdlSelector"},
@@ -1386,7 +1496,8 @@ def __init__( # pylint: disable=too-many-locals
: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. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
: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.
@@ -1428,9 +1539,10 @@ def __init__( # pylint: disable=too-many-locals
: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. Known values are:
- "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", "wsdl-link",
- "openapi", "openapi+json", "openapi-link", "openapi+json-link", and "graphql-link".
+ :keyword format: Format of the Content in which the API is getting imported. New formats can be
+ added in the future. Known values are: "wadl-xml", "wadl-link-json", "swagger-json",
+ "swagger-link-json", "wsdl", "wsdl-link", "openapi", "openapi+json", "openapi-link",
+ "openapi+json-link", "graphql-link", "odata", "odata-link", "grpc", and "grpc-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:
@@ -1441,8 +1553,9 @@ def __init__( # pylint: disable=too-many-locals
* ``http`` creates a REST API
* ``soap`` creates a SOAP pass-through API
* ``websocket`` creates websocket API
- * ``graphql`` creates GraphQL API. Known values are: "http", "soap", "websocket", and
- "graphql".
+ * ``graphql`` creates GraphQL API.
+ New types can be added in the future. Known values are: "http", "soap", "websocket",
+ "graphql", "odata", and "grpc".
:paramtype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType
:keyword translate_required_query_parameters_conduct: Strategy of translating required query
parameters to template ones. By default has value 'template'. Possible values: 'template',
@@ -1472,6 +1585,7 @@ def __init__( # pylint: disable=too-many-locals
self.path = path
self.protocols = protocols
self.api_version_set = api_version_set
+ self.provisioning_state = None
self.value = value
self.format = format
self.wsdl_selector = wsdl_selector
@@ -1494,7 +1608,8 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): # pylint: disable=too
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
: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.
@@ -1536,11 +1651,14 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): # pylint: disable=too
: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 provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
:ivar value: Content value when Importing an API.
:vartype value: str
- :ivar format: Format of the Content in which the API is getting imported. Known values are:
- "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", "wsdl-link",
- "openapi", "openapi+json", "openapi-link", "openapi+json-link", and "graphql-link".
+ :ivar format: Format of the Content in which the API is getting imported. New formats can be
+ added in the future. Known values are: "wadl-xml", "wadl-link-json", "swagger-json",
+ "swagger-link-json", "wsdl", "wsdl-link", "openapi", "openapi+json", "openapi-link",
+ "openapi+json-link", "graphql-link", "odata", "odata-link", "grpc", and "grpc-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:
@@ -1551,8 +1669,9 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): # pylint: disable=too
* ``http`` creates a REST API
* ``soap`` creates a SOAP pass-through API
* ``websocket`` creates websocket API
- * ``graphql`` creates GraphQL API. Known values are: "http", "soap", "websocket", and
- "graphql".
+ * ``graphql`` creates GraphQL API.
+ New types can be added in the future. Known values are: "http", "soap", "websocket",
+ "graphql", "odata", and "grpc".
:vartype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType
:ivar translate_required_query_parameters_conduct: Strategy of translating required query
parameters to template ones. By default has value 'template'. Possible values: 'template',
@@ -1570,6 +1689,7 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): # pylint: disable=too
"display_name": {"max_length": 300, "min_length": 1},
"service_url": {"max_length": 2000},
"path": {"required": True, "max_length": 400},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -1597,6 +1717,7 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): # pylint: disable=too
"path": {"key": "path", "type": "str"},
"protocols": {"key": "protocols", "type": "[str]"},
"api_version_set": {"key": "apiVersionSet", "type": "ApiVersionSetContractDetails"},
+ "provisioning_state": {"key": "provisioningState", "type": "str"},
"value": {"key": "value", "type": "str"},
"format": {"key": "format", "type": "str"},
"wsdl_selector": {"key": "wsdlSelector", "type": "ApiCreateOrUpdatePropertiesWsdlSelector"},
@@ -1645,7 +1766,8 @@ def __init__( # pylint: disable=too-many-locals
: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. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
: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.
@@ -1687,9 +1809,10 @@ def __init__( # pylint: disable=too-many-locals
: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. Known values are:
- "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", "wsdl-link",
- "openapi", "openapi+json", "openapi-link", "openapi+json-link", and "graphql-link".
+ :keyword format: Format of the Content in which the API is getting imported. New formats can be
+ added in the future. Known values are: "wadl-xml", "wadl-link-json", "swagger-json",
+ "swagger-link-json", "wsdl", "wsdl-link", "openapi", "openapi+json", "openapi-link",
+ "openapi+json-link", "graphql-link", "odata", "odata-link", "grpc", and "grpc-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:
@@ -1700,8 +1823,9 @@ def __init__( # pylint: disable=too-many-locals
* ``http`` creates a REST API
* ``soap`` creates a SOAP pass-through API
* ``websocket`` creates websocket API
- * ``graphql`` creates GraphQL API. Known values are: "http", "soap", "websocket", and
- "graphql".
+ * ``graphql`` creates GraphQL API.
+ New types can be added in the future. Known values are: "http", "soap", "websocket",
+ "graphql", "odata", and "grpc".
:paramtype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType
:keyword translate_required_query_parameters_conduct: Strategy of translating required query
parameters to template ones. By default has value 'template'. Possible values: 'template',
@@ -1858,173 +1982,782 @@ def __init__(self, *, name: Optional[str] = None, url: Optional[str] = None, **k
self.url = url
-class ApiManagementServiceApplyNetworkConfigurationParameters(_serialization.Model): # pylint: disable=name-too-long
- """Parameter supplied to the Apply Network configuration operation.
+class ApiManagementGatewayBaseProperties(_serialization.Model):
+ """Base Properties of an API Management gateway resource description.
- :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.
- :vartype location: str
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar provisioning_state: The current provisioning state of the API Management gateway which
+ can be one of the following:
+ Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted.
+ :vartype provisioning_state: str
+ :ivar target_provisioning_state: The provisioning state of the API Management gateway, which is
+ targeted by the long running operation started on the gateway.
+ :vartype target_provisioning_state: str
+ :ivar created_at_utc: Creation UTC date of the API Management gateway.The date conforms to the
+ following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard.
+ :vartype created_at_utc: ~datetime.datetime
+ :ivar frontend: Information regarding how the gateway should be exposed.
+ :vartype frontend: ~azure.mgmt.apimanagement.models.FrontendConfiguration
+ :ivar backend: Information regarding how the gateway should integrate with backend systems.
+ :vartype backend: ~azure.mgmt.apimanagement.models.BackendConfiguration
+ :ivar configuration_api: Information regarding the Configuration API of the API Management
+ gateway. This is only applicable for API gateway with Standard SKU.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.GatewayConfigurationApi
+ :ivar virtual_network_type: The type of VPN in which API Management gateway needs to be
+ configured in. Known values are: "None", "External", and "Internal".
+ :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType
"""
+ _validation = {
+ "provisioning_state": {"readonly": True},
+ "target_provisioning_state": {"readonly": True},
+ "created_at_utc": {"readonly": True},
+ }
+
_attribute_map = {
- "location": {"key": "location", "type": "str"},
+ "provisioning_state": {"key": "provisioningState", "type": "str"},
+ "target_provisioning_state": {"key": "targetProvisioningState", "type": "str"},
+ "created_at_utc": {"key": "createdAtUtc", "type": "iso-8601"},
+ "frontend": {"key": "frontend", "type": "FrontendConfiguration"},
+ "backend": {"key": "backend", "type": "BackendConfiguration"},
+ "configuration_api": {"key": "configurationApi", "type": "GatewayConfigurationApi"},
+ "virtual_network_type": {"key": "virtualNetworkType", "type": "str"},
}
- def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None:
+ def __init__(
+ self,
+ *,
+ frontend: Optional["_models.FrontendConfiguration"] = None,
+ backend: Optional["_models.BackendConfiguration"] = None,
+ configuration_api: Optional["_models.GatewayConfigurationApi"] = None,
+ virtual_network_type: Optional[Union[str, "_models.VirtualNetworkType"]] = None,
+ **kwargs: Any
+ ) -> None:
"""
- :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
+ :keyword frontend: Information regarding how the gateway should be exposed.
+ :paramtype frontend: ~azure.mgmt.apimanagement.models.FrontendConfiguration
+ :keyword backend: Information regarding how the gateway should integrate with backend systems.
+ :paramtype backend: ~azure.mgmt.apimanagement.models.BackendConfiguration
+ :keyword configuration_api: Information regarding the Configuration API of the API Management
+ gateway. This is only applicable for API gateway with Standard SKU.
+ :paramtype configuration_api: ~azure.mgmt.apimanagement.models.GatewayConfigurationApi
+ :keyword virtual_network_type: The type of VPN in which API Management gateway needs to be
+ configured in. Known values are: "None", "External", and "Internal".
+ :paramtype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType
"""
super().__init__(**kwargs)
- self.location = location
+ self.provisioning_state = None
+ self.target_provisioning_state = None
+ self.created_at_utc = None
+ self.frontend = frontend
+ self.backend = backend
+ self.configuration_api = configuration_api
+ self.virtual_network_type = virtual_network_type
-class ApiManagementServiceBackupRestoreParameters(_serialization.Model): # pylint: disable=name-too-long
- """Parameters supplied to the Backup/Restore of an API Management service operation.
+class ApiManagementGatewayConfigConnectionListResult(_serialization.Model): # pylint: disable=name-too-long
+ """The response of the List API Management gateway operation.
All required parameters must be populated in order to send to server.
- :ivar storage_account: The name of the Azure storage account (used to place/retrieve the
- backup). Required.
- :vartype storage_account: str
- :ivar container_name: The name of the blob container (used to place/retrieve the backup).
- Required.
- :vartype container_name: str
- :ivar backup_name: The name of the backup file to create/retrieve. Required.
- :vartype backup_name: str
- :ivar access_type: The type of access to be used for the storage account. Known values are:
- "AccessKey", "SystemAssignedManagedIdentity", and "UserAssignedManagedIdentity".
- :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
+ :ivar value: Result of the List API Management gateway config connection operation. Required.
+ :vartype value:
+ list[~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource]
+ :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list
+ of API Management services.
+ :vartype next_link: str
"""
_validation = {
- "storage_account": {"required": True},
- "container_name": {"required": True},
- "backup_name": {"required": True},
+ "value": {"required": True},
}
_attribute_map = {
- "storage_account": {"key": "storageAccount", "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"},
+ "value": {"key": "value", "type": "[ApiManagementGatewayConfigConnectionResource]"},
+ "next_link": {"key": "nextLink", "type": "str"},
}
def __init__(
self,
*,
- storage_account: str,
- container_name: str,
- backup_name: str,
- access_type: Union[str, "_models.AccessType"] = "AccessKey",
- access_key: Optional[str] = None,
- client_id: Optional[str] = None,
+ value: List["_models.ApiManagementGatewayConfigConnectionResource"],
+ next_link: Optional[str] = None,
**kwargs: Any
) -> None:
"""
- :keyword storage_account: The name of the Azure storage account (used to place/retrieve the
- backup). Required.
- :paramtype storage_account: str
- :keyword container_name: The name of the blob container (used to place/retrieve the backup).
+ :keyword value: Result of the List API Management gateway config connection operation.
Required.
- :paramtype container_name: str
- :keyword backup_name: The name of the backup file to create/retrieve. Required.
- :paramtype backup_name: str
- :keyword access_type: The type of access to be used for the storage account. Known values are:
- "AccessKey", "SystemAssignedManagedIdentity", and "UserAssignedManagedIdentity".
- :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
+ :paramtype value:
+ list[~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource]
+ :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().__init__(**kwargs)
- self.storage_account = storage_account
- 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
+ self.value = value
+ self.next_link = next_link
-class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes
- """Base Properties of an API Management service resource description.
+class ApiManagementGatewayConfigConnectionResource(ProxyResource): # pylint: disable=name-too-long
+ """A single API Management gateway resource in List or Get response.
Variables are only populated by the server, and will be ignored when sending a request.
- :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.
+ :ivar id: Fully qualified resource ID for the resource. Ex -
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
+ :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 etag: ETag of the resource.
+ :vartype etag: str
+ :ivar provisioning_state: The current provisioning state of the API Management gateway config
+ connection.
:vartype provisioning_state: str
- :ivar target_provisioning_state: The provisioning state of the API Management service, which is
- targeted by the long running operation started on the service.
- :vartype target_provisioning_state: str
- :ivar created_at_utc: Creation UTC date of the API Management service.The date conforms to the
- following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard.
- :vartype created_at_utc: ~datetime.datetime
- :ivar gateway_url: Gateway URL of the API Management service.
- :vartype gateway_url: str
- :ivar gateway_regional_url: Gateway URL of the API Management service in the Default Region.
- :vartype gateway_regional_url: str
- :ivar portal_url: Publisher portal endpoint Url of the API Management service.
- :vartype portal_url: str
- :ivar management_api_url: Management API endpoint URL of the API Management service.
- :vartype management_api_url: str
- :ivar scm_url: SCM endpoint URL of the API Management service.
- :vartype scm_url: str
- :ivar developer_portal_url: DEveloper Portal endpoint URL of the API Management service.
- :vartype developer_portal_url: str
- :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]
- :ivar private_ip_addresses: Private Static Load Balanced IP addresses of the API Management
- 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]
- :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'.
- Known values are: "Enabled" and "Disabled".
- :vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
- :ivar virtual_network_configuration: Virtual network configuration of the API Management
- service.
- :vartype virtual_network_configuration:
- ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration
- :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
- 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
+ :ivar source_id: The link to the API Management service workspace.
+ :vartype source_id: str
+ :ivar default_hostname: The default hostname of the data-plane gateway.
+ :vartype default_hostname: str
+ :ivar hostnames: The hostnames of the data-plane gateway to which requests can be sent.
+ :vartype hostnames: list[str]
+ """
+
+ _validation = {
+ "id": {"readonly": True},
+ "name": {"readonly": True},
+ "type": {"readonly": True},
+ "etag": {"readonly": True},
+ "provisioning_state": {"readonly": True},
+ "default_hostname": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ "name": {"key": "name", "type": "str"},
+ "type": {"key": "type", "type": "str"},
+ "etag": {"key": "etag", "type": "str"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
+ "source_id": {"key": "properties.sourceId", "type": "str"},
+ "default_hostname": {"key": "properties.defaultHostname", "type": "str"},
+ "hostnames": {"key": "properties.hostnames", "type": "[str]"},
+ }
+
+ def __init__(
+ self, *, source_id: Optional[str] = None, hostnames: Optional[List[str]] = None, **kwargs: Any
+ ) -> None:
+ """
+ :keyword source_id: The link to the API Management service workspace.
+ :paramtype source_id: str
+ :keyword hostnames: The hostnames of the data-plane gateway to which requests can be sent.
+ :paramtype hostnames: list[str]
+ """
+ super().__init__(**kwargs)
+ self.etag = None
+ self.provisioning_state = None
+ self.source_id = source_id
+ self.default_hostname = None
+ self.hostnames = hostnames
+
+
+class ApiManagementGatewayListResult(_serialization.Model):
+ """The response of the List API Management gateway operation.
+
+ All required parameters must be populated in order to send to server.
+
+ :ivar value: Result of the List API Management gateway operation. Required.
+ :vartype value: list[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list
+ of API Management services.
+ :vartype next_link: str
+ """
+
+ _validation = {
+ "value": {"required": True},
+ }
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[ApiManagementGatewayResource]"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self, *, value: List["_models.ApiManagementGatewayResource"], next_link: Optional[str] = None, **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: Result of the List API Management gateway operation. Required.
+ :paramtype value: list[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :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().__init__(**kwargs)
+ self.value = value
+ self.next_link = next_link
+
+
+class ApiManagementGatewayProperties(ApiManagementGatewayBaseProperties):
+ """Properties of an API Management gateway resource description.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar provisioning_state: The current provisioning state of the API Management gateway which
+ can be one of the following:
+ Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted.
+ :vartype provisioning_state: str
+ :ivar target_provisioning_state: The provisioning state of the API Management gateway, which is
+ targeted by the long running operation started on the gateway.
+ :vartype target_provisioning_state: str
+ :ivar created_at_utc: Creation UTC date of the API Management gateway.The date conforms to the
+ following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard.
+ :vartype created_at_utc: ~datetime.datetime
+ :ivar frontend: Information regarding how the gateway should be exposed.
+ :vartype frontend: ~azure.mgmt.apimanagement.models.FrontendConfiguration
+ :ivar backend: Information regarding how the gateway should integrate with backend systems.
+ :vartype backend: ~azure.mgmt.apimanagement.models.BackendConfiguration
+ :ivar configuration_api: Information regarding the Configuration API of the API Management
+ gateway. This is only applicable for API gateway with Standard SKU.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.GatewayConfigurationApi
+ :ivar virtual_network_type: The type of VPN in which API Management gateway needs to be
+ configured in. Known values are: "None", "External", and "Internal".
+ :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType
+ """
+
+
+class ApimResource(_serialization.Model):
+ """The Resource definition.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar id: Resource ID.
+ :vartype id: str
+ :ivar name: Resource name.
+ :vartype name: str
+ :ivar type: Resource type for API Management resource is set to Microsoft.ApiManagement.
+ :vartype type: str
+ :ivar tags: Resource tags.
+ :vartype tags: dict[str, 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"},
+ "tags": {"key": "tags", "type": "{str}"},
+ }
+
+ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None:
+ """
+ :keyword tags: Resource tags.
+ :paramtype tags: dict[str, str]
+ """
+ super().__init__(**kwargs)
+ self.id = None
+ self.name = None
+ self.type = None
+ self.tags = tags
+
+
+class ApiManagementGatewayResource(ApimResource): # pylint: disable=too-many-instance-attributes
+ """A single API Management gateway resource in List or Get response.
+
+ 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 server.
+
+ :ivar id: Resource ID.
+ :vartype id: str
+ :ivar name: Resource name.
+ :vartype name: str
+ :ivar type: Resource type for API Management resource is set to Microsoft.ApiManagement.
+ :vartype type: str
+ :ivar tags: Resource tags.
+ :vartype tags: dict[str, str]
+ :ivar sku: SKU properties of the API Management gateway. Required.
+ :vartype sku: ~azure.mgmt.apimanagement.models.ApiManagementGatewaySkuProperties
+ :ivar system_data: Metadata pertaining to creation and last modification of the resource.
+ :vartype system_data: ~azure.mgmt.apimanagement.models.SystemData
+ :ivar location: Resource location. Required.
+ :vartype location: str
+ :ivar etag: ETag of the resource.
+ :vartype etag: str
+ :ivar provisioning_state: The current provisioning state of the API Management gateway which
+ can be one of the following:
+ Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted.
+ :vartype provisioning_state: str
+ :ivar target_provisioning_state: The provisioning state of the API Management gateway, which is
+ targeted by the long running operation started on the gateway.
+ :vartype target_provisioning_state: str
+ :ivar created_at_utc: Creation UTC date of the API Management gateway.The date conforms to the
+ following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard.
+ :vartype created_at_utc: ~datetime.datetime
+ :ivar frontend: Information regarding how the gateway should be exposed.
+ :vartype frontend: ~azure.mgmt.apimanagement.models.FrontendConfiguration
+ :ivar backend: Information regarding how the gateway should integrate with backend systems.
+ :vartype backend: ~azure.mgmt.apimanagement.models.BackendConfiguration
+ :ivar configuration_api: Information regarding the Configuration API of the API Management
+ gateway. This is only applicable for API gateway with Standard SKU.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.GatewayConfigurationApi
+ :ivar virtual_network_type: The type of VPN in which API Management gateway needs to be
+ configured in. Known values are: "None", "External", and "Internal".
+ :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType
+ """
+
+ _validation = {
+ "id": {"readonly": True},
+ "name": {"readonly": True},
+ "type": {"readonly": True},
+ "sku": {"required": True},
+ "system_data": {"readonly": True},
+ "location": {"required": True},
+ "etag": {"readonly": True},
+ "provisioning_state": {"readonly": True},
+ "target_provisioning_state": {"readonly": True},
+ "created_at_utc": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ "name": {"key": "name", "type": "str"},
+ "type": {"key": "type", "type": "str"},
+ "tags": {"key": "tags", "type": "{str}"},
+ "sku": {"key": "sku", "type": "ApiManagementGatewaySkuProperties"},
+ "system_data": {"key": "systemData", "type": "SystemData"},
+ "location": {"key": "location", "type": "str"},
+ "etag": {"key": "etag", "type": "str"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
+ "target_provisioning_state": {"key": "properties.targetProvisioningState", "type": "str"},
+ "created_at_utc": {"key": "properties.createdAtUtc", "type": "iso-8601"},
+ "frontend": {"key": "properties.frontend", "type": "FrontendConfiguration"},
+ "backend": {"key": "properties.backend", "type": "BackendConfiguration"},
+ "configuration_api": {"key": "properties.configurationApi", "type": "GatewayConfigurationApi"},
+ "virtual_network_type": {"key": "properties.virtualNetworkType", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ sku: "_models.ApiManagementGatewaySkuProperties",
+ location: str,
+ tags: Optional[Dict[str, str]] = None,
+ frontend: Optional["_models.FrontendConfiguration"] = None,
+ backend: Optional["_models.BackendConfiguration"] = None,
+ configuration_api: Optional["_models.GatewayConfigurationApi"] = None,
+ virtual_network_type: Optional[Union[str, "_models.VirtualNetworkType"]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword tags: Resource tags.
+ :paramtype tags: dict[str, str]
+ :keyword sku: SKU properties of the API Management gateway. Required.
+ :paramtype sku: ~azure.mgmt.apimanagement.models.ApiManagementGatewaySkuProperties
+ :keyword location: Resource location. Required.
+ :paramtype location: str
+ :keyword frontend: Information regarding how the gateway should be exposed.
+ :paramtype frontend: ~azure.mgmt.apimanagement.models.FrontendConfiguration
+ :keyword backend: Information regarding how the gateway should integrate with backend systems.
+ :paramtype backend: ~azure.mgmt.apimanagement.models.BackendConfiguration
+ :keyword configuration_api: Information regarding the Configuration API of the API Management
+ gateway. This is only applicable for API gateway with Standard SKU.
+ :paramtype configuration_api: ~azure.mgmt.apimanagement.models.GatewayConfigurationApi
+ :keyword virtual_network_type: The type of VPN in which API Management gateway needs to be
+ configured in. Known values are: "None", "External", and "Internal".
+ :paramtype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType
+ """
+ super().__init__(tags=tags, **kwargs)
+ self.sku = sku
+ self.system_data = None
+ self.location = location
+ self.etag = None
+ self.provisioning_state = None
+ self.target_provisioning_state = None
+ self.created_at_utc = None
+ self.frontend = frontend
+ self.backend = backend
+ self.configuration_api = configuration_api
+ self.virtual_network_type = virtual_network_type
+
+
+class ApiManagementGatewaySkuProperties(_serialization.Model):
+ """API Management gateway resource SKU properties.
+
+ All required parameters must be populated in order to send to server.
+
+ :ivar name: Name of the Sku. Required. Known values are: "Standard",
+ "WorkspaceGatewayStandard", and "WorkspaceGatewayPremium".
+ :vartype name: str or ~azure.mgmt.apimanagement.models.ApiGatewaySkuType
+ :ivar capacity: Capacity of the SKU (number of deployed units of the SKU).
+ :vartype capacity: int
+ """
+
+ _validation = {
+ "name": {"required": True},
+ }
+
+ _attribute_map = {
+ "name": {"key": "name", "type": "str"},
+ "capacity": {"key": "capacity", "type": "int"},
+ }
+
+ def __init__(
+ self, *, name: Union[str, "_models.ApiGatewaySkuType"], capacity: Optional[int] = None, **kwargs: Any
+ ) -> None:
+ """
+ :keyword name: Name of the Sku. Required. Known values are: "Standard",
+ "WorkspaceGatewayStandard", and "WorkspaceGatewayPremium".
+ :paramtype name: str or ~azure.mgmt.apimanagement.models.ApiGatewaySkuType
+ :keyword capacity: Capacity of the SKU (number of deployed units of the SKU).
+ :paramtype capacity: int
+ """
+ super().__init__(**kwargs)
+ self.name = name
+ self.capacity = capacity
+
+
+class ApiManagementGatewaySkuPropertiesForPatch(_serialization.Model): # pylint: disable=name-too-long
+ """API Management gateway resource SKU properties for PATCH operations given nothing should be
+ required.
+
+ :ivar name: Name of the Sku. Known values are: "Standard", "WorkspaceGatewayStandard", and
+ "WorkspaceGatewayPremium".
+ :vartype name: str or ~azure.mgmt.apimanagement.models.ApiGatewaySkuType
+ :ivar capacity: Capacity of the SKU (number of deployed units of the SKU).
+ :vartype capacity: int
+ """
+
+ _attribute_map = {
+ "name": {"key": "name", "type": "str"},
+ "capacity": {"key": "capacity", "type": "int"},
+ }
+
+ def __init__(
+ self,
+ *,
+ name: Optional[Union[str, "_models.ApiGatewaySkuType"]] = None,
+ capacity: Optional[int] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword name: Name of the Sku. Known values are: "Standard", "WorkspaceGatewayStandard", and
+ "WorkspaceGatewayPremium".
+ :paramtype name: str or ~azure.mgmt.apimanagement.models.ApiGatewaySkuType
+ :keyword capacity: Capacity of the SKU (number of deployed units of the SKU).
+ :paramtype capacity: int
+ """
+ super().__init__(**kwargs)
+ self.name = name
+ self.capacity = capacity
+
+
+class ApiManagementGatewayUpdateParameters(ApimResource): # pylint: disable=too-many-instance-attributes
+ """Parameter supplied to Update API Management gateway.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar id: Resource ID.
+ :vartype id: str
+ :ivar name: Resource name.
+ :vartype name: str
+ :ivar type: Resource type for API Management resource is set to Microsoft.ApiManagement.
+ :vartype type: str
+ :ivar tags: Resource tags.
+ :vartype tags: dict[str, str]
+ :ivar sku: SKU properties of the API Management gateway.
+ :vartype sku: ~azure.mgmt.apimanagement.models.ApiManagementGatewaySkuPropertiesForPatch
+ :ivar etag: ETag of the resource.
+ :vartype etag: str
+ :ivar provisioning_state: The current provisioning state of the API Management gateway which
+ can be one of the following:
+ Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted.
+ :vartype provisioning_state: str
+ :ivar target_provisioning_state: The provisioning state of the API Management gateway, which is
+ targeted by the long running operation started on the gateway.
+ :vartype target_provisioning_state: str
+ :ivar created_at_utc: Creation UTC date of the API Management gateway.The date conforms to the
+ following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard.
+ :vartype created_at_utc: ~datetime.datetime
+ :ivar frontend: Information regarding how the gateway should be exposed.
+ :vartype frontend: ~azure.mgmt.apimanagement.models.FrontendConfiguration
+ :ivar backend: Information regarding how the gateway should integrate with backend systems.
+ :vartype backend: ~azure.mgmt.apimanagement.models.BackendConfiguration
+ :ivar configuration_api: Information regarding the Configuration API of the API Management
+ gateway. This is only applicable for API gateway with Standard SKU.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.GatewayConfigurationApi
+ :ivar virtual_network_type: The type of VPN in which API Management gateway needs to be
+ configured in. Known values are: "None", "External", and "Internal".
+ :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType
+ """
+
+ _validation = {
+ "id": {"readonly": True},
+ "name": {"readonly": True},
+ "type": {"readonly": True},
+ "etag": {"readonly": True},
+ "provisioning_state": {"readonly": True},
+ "target_provisioning_state": {"readonly": True},
+ "created_at_utc": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ "name": {"key": "name", "type": "str"},
+ "type": {"key": "type", "type": "str"},
+ "tags": {"key": "tags", "type": "{str}"},
+ "sku": {"key": "sku", "type": "ApiManagementGatewaySkuPropertiesForPatch"},
+ "etag": {"key": "etag", "type": "str"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
+ "target_provisioning_state": {"key": "properties.targetProvisioningState", "type": "str"},
+ "created_at_utc": {"key": "properties.createdAtUtc", "type": "iso-8601"},
+ "frontend": {"key": "properties.frontend", "type": "FrontendConfiguration"},
+ "backend": {"key": "properties.backend", "type": "BackendConfiguration"},
+ "configuration_api": {"key": "properties.configurationApi", "type": "GatewayConfigurationApi"},
+ "virtual_network_type": {"key": "properties.virtualNetworkType", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ tags: Optional[Dict[str, str]] = None,
+ sku: Optional["_models.ApiManagementGatewaySkuPropertiesForPatch"] = None,
+ frontend: Optional["_models.FrontendConfiguration"] = None,
+ backend: Optional["_models.BackendConfiguration"] = None,
+ configuration_api: Optional["_models.GatewayConfigurationApi"] = None,
+ virtual_network_type: Optional[Union[str, "_models.VirtualNetworkType"]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword tags: Resource tags.
+ :paramtype tags: dict[str, str]
+ :keyword sku: SKU properties of the API Management gateway.
+ :paramtype sku: ~azure.mgmt.apimanagement.models.ApiManagementGatewaySkuPropertiesForPatch
+ :keyword frontend: Information regarding how the gateway should be exposed.
+ :paramtype frontend: ~azure.mgmt.apimanagement.models.FrontendConfiguration
+ :keyword backend: Information regarding how the gateway should integrate with backend systems.
+ :paramtype backend: ~azure.mgmt.apimanagement.models.BackendConfiguration
+ :keyword configuration_api: Information regarding the Configuration API of the API Management
+ gateway. This is only applicable for API gateway with Standard SKU.
+ :paramtype configuration_api: ~azure.mgmt.apimanagement.models.GatewayConfigurationApi
+ :keyword virtual_network_type: The type of VPN in which API Management gateway needs to be
+ configured in. Known values are: "None", "External", and "Internal".
+ :paramtype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType
+ """
+ super().__init__(tags=tags, **kwargs)
+ self.sku = sku
+ self.etag = None
+ self.provisioning_state = None
+ self.target_provisioning_state = None
+ self.created_at_utc = None
+ self.frontend = frontend
+ self.backend = backend
+ self.configuration_api = configuration_api
+ self.virtual_network_type = virtual_network_type
+
+
+class ApiManagementGatewayUpdateProperties(ApiManagementGatewayBaseProperties):
+ """Properties of an API Management gateway resource description.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar provisioning_state: The current provisioning state of the API Management gateway which
+ can be one of the following:
+ Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted.
+ :vartype provisioning_state: str
+ :ivar target_provisioning_state: The provisioning state of the API Management gateway, which is
+ targeted by the long running operation started on the gateway.
+ :vartype target_provisioning_state: str
+ :ivar created_at_utc: Creation UTC date of the API Management gateway.The date conforms to the
+ following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard.
+ :vartype created_at_utc: ~datetime.datetime
+ :ivar frontend: Information regarding how the gateway should be exposed.
+ :vartype frontend: ~azure.mgmt.apimanagement.models.FrontendConfiguration
+ :ivar backend: Information regarding how the gateway should integrate with backend systems.
+ :vartype backend: ~azure.mgmt.apimanagement.models.BackendConfiguration
+ :ivar configuration_api: Information regarding the Configuration API of the API Management
+ gateway. This is only applicable for API gateway with Standard SKU.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.GatewayConfigurationApi
+ :ivar virtual_network_type: The type of VPN in which API Management gateway needs to be
+ configured in. Known values are: "None", "External", and "Internal".
+ :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType
+ """
+
+
+class ApiManagementServiceApplyNetworkConfigurationParameters(_serialization.Model): # pylint: disable=name-too-long
+ """Parameter supplied to the Apply Network configuration operation.
+
+ :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.
+ :vartype location: str
+ """
+
+ _attribute_map = {
+ "location": {"key": "location", "type": "str"},
+ }
+
+ def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :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().__init__(**kwargs)
+ self.location = location
+
+
+class ApiManagementServiceBackupRestoreParameters(_serialization.Model): # pylint: disable=name-too-long
+ """Parameters supplied to the Backup/Restore of an API Management service operation.
+
+ All required parameters must be populated in order to send to server.
+
+ :ivar storage_account: The name of the Azure storage account (used to place/retrieve the
+ backup). Required.
+ :vartype storage_account: str
+ :ivar container_name: The name of the blob container (used to place/retrieve the backup).
+ Required.
+ :vartype container_name: str
+ :ivar backup_name: The name of the backup file to create/retrieve. Required.
+ :vartype backup_name: str
+ :ivar access_type: The type of access to be used for the storage account. Known values are:
+ "AccessKey", "SystemAssignedManagedIdentity", and "UserAssignedManagedIdentity".
+ :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},
+ "container_name": {"required": True},
+ "backup_name": {"required": True},
+ }
+
+ _attribute_map = {
+ "storage_account": {"key": "storageAccount", "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,
+ container_name: str,
+ backup_name: str,
+ access_type: Union[str, "_models.AccessType"] = "AccessKey",
+ access_key: Optional[str] = None,
+ client_id: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword storage_account: The name of the Azure storage account (used to place/retrieve the
+ backup). Required.
+ :paramtype storage_account: str
+ :keyword container_name: The name of the blob container (used to place/retrieve the backup).
+ Required.
+ :paramtype container_name: str
+ :keyword backup_name: The name of the backup file to create/retrieve. Required.
+ :paramtype backup_name: str
+ :keyword access_type: The type of access to be used for the storage account. Known values are:
+ "AccessKey", "SystemAssignedManagedIdentity", and "UserAssignedManagedIdentity".
+ :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().__init__(**kwargs)
+ self.storage_account = storage_account
+ 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(_serialization.Model): # pylint: disable=too-many-instance-attributes
+ """Base Properties of an API Management service resource description.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :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.
+ :vartype provisioning_state: str
+ :ivar target_provisioning_state: The provisioning state of the API Management service, which is
+ targeted by the long running operation started on the service.
+ :vartype target_provisioning_state: str
+ :ivar created_at_utc: Creation UTC date of the API Management service.The date conforms to the
+ following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard.
+ :vartype created_at_utc: ~datetime.datetime
+ :ivar gateway_url: Gateway URL of the API Management service.
+ :vartype gateway_url: str
+ :ivar gateway_regional_url: Gateway URL of the API Management service in the Default Region.
+ :vartype gateway_regional_url: str
+ :ivar portal_url: Publisher portal endpoint Url of the API Management service.
+ :vartype portal_url: str
+ :ivar management_api_url: Management API endpoint URL of the API Management service.
+ :vartype management_api_url: str
+ :ivar scm_url: SCM endpoint URL of the API Management service.
+ :vartype scm_url: str
+ :ivar developer_portal_url: DEveloper Portal endpoint URL of the API Management service.
+ :vartype developer_portal_url: str
+ :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]
+ :ivar private_ip_addresses: Private Static Load Balanced IP addresses of the API Management
+ 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]
+ :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'.
+ Known values are: "Enabled" and "Disabled".
+ :vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :ivar configuration_api: Configuration API configuration of the API Management service.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
+ :ivar virtual_network_configuration: Virtual network configuration of the API Management
+ service.
+ :vartype virtual_network_configuration:
+ ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration
+ :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
+ 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 1,
2018 and ``False`` otherwise. Http2 setting's default value is ``False``.You can
disable any of the following ciphers by using settings
@@ -2034,7 +2767,7 @@ class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disab
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`:\
+ `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\\
``false``. The default value is ``true`` for them. Note: The following ciphers can't be
disabled since they are required by internal platform components:
TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,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. # pylint: disable=line-too-long
@@ -2072,8 +2805,17 @@ class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disab
:vartype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
:ivar platform_version: Compute Platform Version running the service in this location. Known
- values are: "undetermined", "stv1", "stv2", and "mtv1".
+ values are: "undetermined", "stv1", "stv2", "mtv1", and "stv2.1".
:vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion
+ :ivar legacy_portal_status: Status of legacy portal in the API Management service. Known values
+ are: "Enabled" and "Disabled".
+ :vartype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :ivar developer_portal_status: Status of developer portal in this API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :vartype developer_portal_status: str or ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
+ :ivar release_channel: Release Channel of this API Management service. Known values are:
+ "Preview", "Default", and "Stable".
+ :vartype release_channel: str or ~azure.mgmt.apimanagement.models.ReleaseChannel
"""
_validation = {
@@ -2109,6 +2851,7 @@ class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disab
"private_ip_addresses": {"key": "privateIPAddresses", "type": "[str]"},
"public_ip_address_id": {"key": "publicIpAddressId", "type": "str"},
"public_network_access": {"key": "publicNetworkAccess", "type": "str"},
+ "configuration_api": {"key": "configurationApi", "type": "ConfigurationApi"},
"virtual_network_configuration": {"key": "virtualNetworkConfiguration", "type": "VirtualNetworkConfiguration"},
"additional_locations": {"key": "additionalLocations", "type": "[AdditionalLocation]"},
"custom_properties": {"key": "customProperties", "type": "{str}"},
@@ -2125,6 +2868,9 @@ class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disab
"type": "[RemotePrivateEndpointConnectionWrapper]",
},
"platform_version": {"key": "platformVersion", "type": "str"},
+ "legacy_portal_status": {"key": "legacyPortalStatus", "type": "str"},
+ "developer_portal_status": {"key": "developerPortalStatus", "type": "str"},
+ "release_channel": {"key": "releaseChannel", "type": "str"},
}
def __init__( # pylint: disable=too-many-locals
@@ -2134,6 +2880,7 @@ def __init__( # pylint: disable=too-many-locals
hostname_configurations: Optional[List["_models.HostnameConfiguration"]] = None,
public_ip_address_id: Optional[str] = None,
public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None,
+ configuration_api: Optional["_models.ConfigurationApi"] = None,
virtual_network_configuration: Optional["_models.VirtualNetworkConfiguration"] = None,
additional_locations: Optional[List["_models.AdditionalLocation"]] = None,
custom_properties: Optional[Dict[str, str]] = None,
@@ -2141,10 +2888,13 @@ def __init__( # pylint: disable=too-many-locals
enable_client_certificate: bool = False,
nat_gateway_state: Optional[Union[str, "_models.NatGatewayState"]] = None,
disable_gateway: bool = False,
- virtual_network_type: Union[str, "_models.VirtualNetworkType"] = "None",
+ virtual_network_type: Optional[Union[str, "_models.VirtualNetworkType"]] = None,
api_version_constraint: Optional["_models.ApiVersionConstraint"] = None,
restore: bool = False,
private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None,
+ legacy_portal_status: Union[str, "_models.LegacyPortalStatus"] = "Enabled",
+ developer_portal_status: Union[str, "_models.DeveloperPortalStatus"] = "Enabled",
+ release_channel: Optional[Union[str, "_models.ReleaseChannel"]] = None,
**kwargs: Any
) -> None:
"""
@@ -2162,6 +2912,8 @@ def __init__( # pylint: disable=too-many-locals
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :keyword configuration_api: Configuration API configuration of the API Management service.
+ :paramtype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:keyword virtual_network_configuration: Virtual network configuration of the API Management
service.
:paramtype virtual_network_configuration:
@@ -2191,7 +2943,7 @@ def __init__( # pylint: disable=too-many-locals
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`:\
+ `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\\
``false``. The default value is ``true`` for them. Note: The following ciphers can't be
disabled since they are required by internal platform components:
TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,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. # pylint: disable=line-too-long
@@ -2225,6 +2977,16 @@ def __init__( # pylint: disable=too-many-locals
:keyword private_endpoint_connections: List of Private Endpoint Connections of this service.
:paramtype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
+ :keyword legacy_portal_status: Status of legacy portal in the API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :paramtype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :keyword developer_portal_status: Status of developer portal in this API Management service.
+ Known values are: "Enabled" and "Disabled".
+ :paramtype developer_portal_status: str or
+ ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
+ :keyword release_channel: Release Channel of this API Management service. Known values are:
+ "Preview", "Default", and "Stable".
+ :paramtype release_channel: str or ~azure.mgmt.apimanagement.models.ReleaseChannel
"""
super().__init__(**kwargs)
self.notification_sender_email = notification_sender_email
@@ -2242,6 +3004,7 @@ def __init__( # pylint: disable=too-many-locals
self.private_ip_addresses = None
self.public_ip_address_id = public_ip_address_id
self.public_network_access = public_network_access
+ self.configuration_api = configuration_api
self.virtual_network_configuration = virtual_network_configuration
self.additional_locations = additional_locations
self.custom_properties = custom_properties
@@ -2255,6 +3018,9 @@ def __init__( # pylint: disable=too-many-locals
self.restore = restore
self.private_endpoint_connections = private_endpoint_connections
self.platform_version = None
+ self.legacy_portal_status = legacy_portal_status
+ self.developer_portal_status = developer_portal_status
+ self.release_channel = release_channel
class ApiManagementServiceCheckNameAvailabilityParameters(_serialization.Model): # pylint: disable=name-too-long
@@ -2524,6 +3290,8 @@ class ApiManagementServiceProperties(
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :ivar configuration_api: Configuration API configuration of the API Management service.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:ivar virtual_network_configuration: Virtual network configuration of the API Management
service.
:vartype virtual_network_configuration:
@@ -2553,7 +3321,7 @@ class ApiManagementServiceProperties(
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`:\
+ `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\\
``false``. The default value is ``true`` for them. Note: The following ciphers can't be
disabled since they are required by internal platform components:
TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,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. # pylint: disable=line-too-long
@@ -2591,8 +3359,17 @@ class ApiManagementServiceProperties(
:vartype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
:ivar platform_version: Compute Platform Version running the service in this location. Known
- values are: "undetermined", "stv1", "stv2", and "mtv1".
+ values are: "undetermined", "stv1", "stv2", "mtv1", and "stv2.1".
:vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion
+ :ivar legacy_portal_status: Status of legacy portal in the API Management service. Known values
+ are: "Enabled" and "Disabled".
+ :vartype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :ivar developer_portal_status: Status of developer portal in this API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :vartype developer_portal_status: str or ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
+ :ivar release_channel: Release Channel of this API Management service. Known values are:
+ "Preview", "Default", and "Stable".
+ :vartype release_channel: str or ~azure.mgmt.apimanagement.models.ReleaseChannel
:ivar publisher_email: Publisher email. Required.
:vartype publisher_email: str
:ivar publisher_name: Publisher name. Required.
@@ -2634,6 +3411,7 @@ class ApiManagementServiceProperties(
"private_ip_addresses": {"key": "privateIPAddresses", "type": "[str]"},
"public_ip_address_id": {"key": "publicIpAddressId", "type": "str"},
"public_network_access": {"key": "publicNetworkAccess", "type": "str"},
+ "configuration_api": {"key": "configurationApi", "type": "ConfigurationApi"},
"virtual_network_configuration": {"key": "virtualNetworkConfiguration", "type": "VirtualNetworkConfiguration"},
"additional_locations": {"key": "additionalLocations", "type": "[AdditionalLocation]"},
"custom_properties": {"key": "customProperties", "type": "{str}"},
@@ -2650,6 +3428,9 @@ class ApiManagementServiceProperties(
"type": "[RemotePrivateEndpointConnectionWrapper]",
},
"platform_version": {"key": "platformVersion", "type": "str"},
+ "legacy_portal_status": {"key": "legacyPortalStatus", "type": "str"},
+ "developer_portal_status": {"key": "developerPortalStatus", "type": "str"},
+ "release_channel": {"key": "releaseChannel", "type": "str"},
"publisher_email": {"key": "publisherEmail", "type": "str"},
"publisher_name": {"key": "publisherName", "type": "str"},
}
@@ -2663,6 +3444,7 @@ def __init__( # pylint: disable=too-many-locals
hostname_configurations: Optional[List["_models.HostnameConfiguration"]] = None,
public_ip_address_id: Optional[str] = None,
public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None,
+ configuration_api: Optional["_models.ConfigurationApi"] = None,
virtual_network_configuration: Optional["_models.VirtualNetworkConfiguration"] = None,
additional_locations: Optional[List["_models.AdditionalLocation"]] = None,
custom_properties: Optional[Dict[str, str]] = None,
@@ -2670,10 +3452,13 @@ def __init__( # pylint: disable=too-many-locals
enable_client_certificate: bool = False,
nat_gateway_state: Optional[Union[str, "_models.NatGatewayState"]] = None,
disable_gateway: bool = False,
- virtual_network_type: Union[str, "_models.VirtualNetworkType"] = "None",
+ virtual_network_type: Optional[Union[str, "_models.VirtualNetworkType"]] = None,
api_version_constraint: Optional["_models.ApiVersionConstraint"] = None,
restore: bool = False,
private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None,
+ legacy_portal_status: Union[str, "_models.LegacyPortalStatus"] = "Enabled",
+ developer_portal_status: Union[str, "_models.DeveloperPortalStatus"] = "Enabled",
+ release_channel: Optional[Union[str, "_models.ReleaseChannel"]] = None,
**kwargs: Any
) -> None:
"""
@@ -2691,6 +3476,8 @@ def __init__( # pylint: disable=too-many-locals
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :keyword configuration_api: Configuration API configuration of the API Management service.
+ :paramtype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:keyword virtual_network_configuration: Virtual network configuration of the API Management
service.
:paramtype virtual_network_configuration:
@@ -2720,7 +3507,7 @@ def __init__( # pylint: disable=too-many-locals
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`:\
+ `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\\
``false``. The default value is ``true`` for them. Note: The following ciphers can't be
disabled since they are required by internal platform components:
TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,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. # pylint: disable=line-too-long
@@ -2754,6 +3541,16 @@ def __init__( # pylint: disable=too-many-locals
:keyword private_endpoint_connections: List of Private Endpoint Connections of this service.
:paramtype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
+ :keyword legacy_portal_status: Status of legacy portal in the API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :paramtype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :keyword developer_portal_status: Status of developer portal in this API Management service.
+ Known values are: "Enabled" and "Disabled".
+ :paramtype developer_portal_status: str or
+ ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
+ :keyword release_channel: Release Channel of this API Management service. Known values are:
+ "Preview", "Default", and "Stable".
+ :paramtype release_channel: str or ~azure.mgmt.apimanagement.models.ReleaseChannel
:keyword publisher_email: Publisher email. Required.
:paramtype publisher_email: str
:keyword publisher_name: Publisher name. Required.
@@ -2764,61 +3561,25 @@ def __init__( # pylint: disable=too-many-locals
hostname_configurations=hostname_configurations,
public_ip_address_id=public_ip_address_id,
public_network_access=public_network_access,
+ configuration_api=configuration_api,
virtual_network_configuration=virtual_network_configuration,
additional_locations=additional_locations,
custom_properties=custom_properties,
- certificates=certificates,
- enable_client_certificate=enable_client_certificate,
- nat_gateway_state=nat_gateway_state,
- 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
-
-
-class ApimResource(_serialization.Model):
- """The Resource definition.
-
- Variables are only populated by the server, and will be ignored when sending a request.
-
- :ivar id: Resource ID.
- :vartype id: str
- :ivar name: Resource name.
- :vartype name: str
- :ivar type: Resource type for API Management resource is set to Microsoft.ApiManagement.
- :vartype type: str
- :ivar tags: Resource tags.
- :vartype tags: dict[str, 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"},
- "tags": {"key": "tags", "type": "{str}"},
- }
-
- def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None:
- """
- :keyword tags: Resource tags.
- :paramtype tags: dict[str, str]
- """
- super().__init__(**kwargs)
- self.id = None
- self.name = None
- self.type = None
- self.tags = tags
+ certificates=certificates,
+ enable_client_certificate=enable_client_certificate,
+ nat_gateway_state=nat_gateway_state,
+ disable_gateway=disable_gateway,
+ virtual_network_type=virtual_network_type,
+ api_version_constraint=api_version_constraint,
+ restore=restore,
+ private_endpoint_connections=private_endpoint_connections,
+ legacy_portal_status=legacy_portal_status,
+ developer_portal_status=developer_portal_status,
+ release_channel=release_channel,
+ **kwargs
+ )
+ self.publisher_email = publisher_email
+ self.publisher_name = publisher_name
class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-instance-attributes
@@ -2890,6 +3651,8 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :ivar configuration_api: Configuration API configuration of the API Management service.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:ivar virtual_network_configuration: Virtual network configuration of the API Management
service.
:vartype virtual_network_configuration:
@@ -2919,7 +3682,7 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in
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`:\
+ `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\\
``false``. The default value is ``true`` for them. Note: The following ciphers can't be
disabled since they are required by internal platform components:
TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,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. # pylint: disable=line-too-long
@@ -2957,8 +3720,17 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in
:vartype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
:ivar platform_version: Compute Platform Version running the service in this location. Known
- values are: "undetermined", "stv1", "stv2", and "mtv1".
+ values are: "undetermined", "stv1", "stv2", "mtv1", and "stv2.1".
:vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion
+ :ivar legacy_portal_status: Status of legacy portal in the API Management service. Known values
+ are: "Enabled" and "Disabled".
+ :vartype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :ivar developer_portal_status: Status of developer portal in this API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :vartype developer_portal_status: str or ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
+ :ivar release_channel: Release Channel of this API Management service. Known values are:
+ "Preview", "Default", and "Stable".
+ :vartype release_channel: str or ~azure.mgmt.apimanagement.models.ReleaseChannel
:ivar publisher_email: Publisher email. Required.
:vartype publisher_email: str
:ivar publisher_name: Publisher name. Required.
@@ -3017,6 +3789,7 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in
"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"},
+ "configuration_api": {"key": "properties.configurationApi", "type": "ConfigurationApi"},
"virtual_network_configuration": {
"key": "properties.virtualNetworkConfiguration",
"type": "VirtualNetworkConfiguration",
@@ -3036,6 +3809,9 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in
"type": "[RemotePrivateEndpointConnectionWrapper]",
},
"platform_version": {"key": "properties.platformVersion", "type": "str"},
+ "legacy_portal_status": {"key": "properties.legacyPortalStatus", "type": "str"},
+ "developer_portal_status": {"key": "properties.developerPortalStatus", "type": "str"},
+ "release_channel": {"key": "properties.releaseChannel", "type": "str"},
"publisher_email": {"key": "properties.publisherEmail", "type": "str"},
"publisher_name": {"key": "properties.publisherName", "type": "str"},
}
@@ -3054,6 +3830,7 @@ def __init__( # pylint: disable=too-many-locals
hostname_configurations: Optional[List["_models.HostnameConfiguration"]] = None,
public_ip_address_id: Optional[str] = None,
public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None,
+ configuration_api: Optional["_models.ConfigurationApi"] = None,
virtual_network_configuration: Optional["_models.VirtualNetworkConfiguration"] = None,
additional_locations: Optional[List["_models.AdditionalLocation"]] = None,
custom_properties: Optional[Dict[str, str]] = None,
@@ -3061,10 +3838,13 @@ def __init__( # pylint: disable=too-many-locals
enable_client_certificate: bool = False,
nat_gateway_state: Optional[Union[str, "_models.NatGatewayState"]] = None,
disable_gateway: bool = False,
- virtual_network_type: Union[str, "_models.VirtualNetworkType"] = "None",
+ virtual_network_type: Optional[Union[str, "_models.VirtualNetworkType"]] = None,
api_version_constraint: Optional["_models.ApiVersionConstraint"] = None,
restore: bool = False,
private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None,
+ legacy_portal_status: Union[str, "_models.LegacyPortalStatus"] = "Enabled",
+ developer_portal_status: Union[str, "_models.DeveloperPortalStatus"] = "Enabled",
+ release_channel: Optional[Union[str, "_models.ReleaseChannel"]] = None,
**kwargs: Any
) -> None:
"""
@@ -3092,6 +3872,8 @@ def __init__( # pylint: disable=too-many-locals
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :keyword configuration_api: Configuration API configuration of the API Management service.
+ :paramtype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:keyword virtual_network_configuration: Virtual network configuration of the API Management
service.
:paramtype virtual_network_configuration:
@@ -3121,7 +3903,7 @@ def __init__( # pylint: disable=too-many-locals
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`:\
+ `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\\
``false``. The default value is ``true`` for them. Note: The following ciphers can't be
disabled since they are required by internal platform components:
TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,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. # pylint: disable=line-too-long
@@ -3155,6 +3937,16 @@ def __init__( # pylint: disable=too-many-locals
:keyword private_endpoint_connections: List of Private Endpoint Connections of this service.
:paramtype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
+ :keyword legacy_portal_status: Status of legacy portal in the API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :paramtype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :keyword developer_portal_status: Status of developer portal in this API Management service.
+ Known values are: "Enabled" and "Disabled".
+ :paramtype developer_portal_status: str or
+ ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
+ :keyword release_channel: Release Channel of this API Management service. Known values are:
+ "Preview", "Default", and "Stable".
+ :paramtype release_channel: str or ~azure.mgmt.apimanagement.models.ReleaseChannel
:keyword publisher_email: Publisher email. Required.
:paramtype publisher_email: str
:keyword publisher_name: Publisher name. Required.
@@ -3182,6 +3974,7 @@ def __init__( # pylint: disable=too-many-locals
self.private_ip_addresses = None
self.public_ip_address_id = public_ip_address_id
self.public_network_access = public_network_access
+ self.configuration_api = configuration_api
self.virtual_network_configuration = virtual_network_configuration
self.additional_locations = additional_locations
self.custom_properties = custom_properties
@@ -3195,6 +3988,9 @@ def __init__( # pylint: disable=too-many-locals
self.restore = restore
self.private_endpoint_connections = private_endpoint_connections
self.platform_version = None
+ self.legacy_portal_status = legacy_portal_status
+ self.developer_portal_status = developer_portal_status
+ self.release_channel = release_channel
self.publisher_email = publisher_email
self.publisher_name = publisher_name
@@ -3205,7 +4001,7 @@ class ApiManagementServiceSkuProperties(_serialization.Model):
All required parameters must be populated in order to send to server.
:ivar name: Name of the Sku. Required. Known values are: "Developer", "Standard", "Premium",
- "Basic", "Consumption", and "Isolated".
+ "Basic", "Consumption", "Isolated", "BasicV2", and "StandardV2".
:vartype name: str or ~azure.mgmt.apimanagement.models.SkuType
:ivar capacity: Capacity of the SKU (number of deployed units of the SKU). For Consumption SKU
capacity must be specified as 0. Required.
@@ -3225,7 +4021,7 @@ class ApiManagementServiceSkuProperties(_serialization.Model):
def __init__(self, *, name: Union[str, "_models.SkuType"], capacity: int, **kwargs: Any) -> None:
"""
:keyword name: Name of the Sku. Required. Known values are: "Developer", "Standard", "Premium",
- "Basic", "Consumption", and "Isolated".
+ "Basic", "Consumption", "Isolated", "BasicV2", and "StandardV2".
:paramtype name: str or ~azure.mgmt.apimanagement.models.SkuType
:keyword capacity: Capacity of the SKU (number of deployed units of the SKU). For Consumption
SKU capacity must be specified as 0. Required.
@@ -3299,6 +4095,8 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :ivar configuration_api: Configuration API configuration of the API Management service.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:ivar virtual_network_configuration: Virtual network configuration of the API Management
service.
:vartype virtual_network_configuration:
@@ -3328,7 +4126,7 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too
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`:\
+ `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\\
``false``. The default value is ``true`` for them. Note: The following ciphers can't be
disabled since they are required by internal platform components:
TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,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. # pylint: disable=line-too-long
@@ -3366,8 +4164,17 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too
:vartype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
:ivar platform_version: Compute Platform Version running the service in this location. Known
- values are: "undetermined", "stv1", "stv2", and "mtv1".
+ values are: "undetermined", "stv1", "stv2", "mtv1", and "stv2.1".
:vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion
+ :ivar legacy_portal_status: Status of legacy portal in the API Management service. Known values
+ are: "Enabled" and "Disabled".
+ :vartype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :ivar developer_portal_status: Status of developer portal in this API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :vartype developer_portal_status: str or ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
+ :ivar release_channel: Release Channel of this API Management service. Known values are:
+ "Preview", "Default", and "Stable".
+ :vartype release_channel: str or ~azure.mgmt.apimanagement.models.ReleaseChannel
:ivar publisher_email: Publisher email.
:vartype publisher_email: str
:ivar publisher_name: Publisher name.
@@ -3421,6 +4228,7 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too
"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"},
+ "configuration_api": {"key": "properties.configurationApi", "type": "ConfigurationApi"},
"virtual_network_configuration": {
"key": "properties.virtualNetworkConfiguration",
"type": "VirtualNetworkConfiguration",
@@ -3440,6 +4248,9 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too
"type": "[RemotePrivateEndpointConnectionWrapper]",
},
"platform_version": {"key": "properties.platformVersion", "type": "str"},
+ "legacy_portal_status": {"key": "properties.legacyPortalStatus", "type": "str"},
+ "developer_portal_status": {"key": "properties.developerPortalStatus", "type": "str"},
+ "release_channel": {"key": "properties.releaseChannel", "type": "str"},
"publisher_email": {"key": "properties.publisherEmail", "type": "str"},
"publisher_name": {"key": "properties.publisherName", "type": "str"},
}
@@ -3455,6 +4266,7 @@ def __init__( # pylint: disable=too-many-locals
hostname_configurations: Optional[List["_models.HostnameConfiguration"]] = None,
public_ip_address_id: Optional[str] = None,
public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None,
+ configuration_api: Optional["_models.ConfigurationApi"] = None,
virtual_network_configuration: Optional["_models.VirtualNetworkConfiguration"] = None,
additional_locations: Optional[List["_models.AdditionalLocation"]] = None,
custom_properties: Optional[Dict[str, str]] = None,
@@ -3462,10 +4274,13 @@ def __init__( # pylint: disable=too-many-locals
enable_client_certificate: bool = False,
nat_gateway_state: Optional[Union[str, "_models.NatGatewayState"]] = None,
disable_gateway: bool = False,
- virtual_network_type: Union[str, "_models.VirtualNetworkType"] = "None",
+ virtual_network_type: Optional[Union[str, "_models.VirtualNetworkType"]] = None,
api_version_constraint: Optional["_models.ApiVersionConstraint"] = None,
restore: bool = False,
private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None,
+ legacy_portal_status: Union[str, "_models.LegacyPortalStatus"] = "Enabled",
+ developer_portal_status: Union[str, "_models.DeveloperPortalStatus"] = "Enabled",
+ release_channel: Optional[Union[str, "_models.ReleaseChannel"]] = None,
publisher_email: Optional[str] = None,
publisher_name: Optional[str] = None,
**kwargs: Any
@@ -3493,6 +4308,8 @@ def __init__( # pylint: disable=too-many-locals
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :keyword configuration_api: Configuration API configuration of the API Management service.
+ :paramtype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:keyword virtual_network_configuration: Virtual network configuration of the API Management
service.
:paramtype virtual_network_configuration:
@@ -3522,7 +4339,7 @@ def __init__( # pylint: disable=too-many-locals
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`:\
+ `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\\
``false``. The default value is ``true`` for them. Note: The following ciphers can't be
disabled since they are required by internal platform components:
TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,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. # pylint: disable=line-too-long
@@ -3556,6 +4373,16 @@ def __init__( # pylint: disable=too-many-locals
:keyword private_endpoint_connections: List of Private Endpoint Connections of this service.
:paramtype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
+ :keyword legacy_portal_status: Status of legacy portal in the API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :paramtype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :keyword developer_portal_status: Status of developer portal in this API Management service.
+ Known values are: "Enabled" and "Disabled".
+ :paramtype developer_portal_status: str or
+ ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
+ :keyword release_channel: Release Channel of this API Management service. Known values are:
+ "Preview", "Default", and "Stable".
+ :paramtype release_channel: str or ~azure.mgmt.apimanagement.models.ReleaseChannel
:keyword publisher_email: Publisher email.
:paramtype publisher_email: str
:keyword publisher_name: Publisher name.
@@ -3581,6 +4408,7 @@ def __init__( # pylint: disable=too-many-locals
self.private_ip_addresses = None
self.public_ip_address_id = public_ip_address_id
self.public_network_access = public_network_access
+ self.configuration_api = configuration_api
self.virtual_network_configuration = virtual_network_configuration
self.additional_locations = additional_locations
self.custom_properties = custom_properties
@@ -3594,6 +4422,9 @@ def __init__( # pylint: disable=too-many-locals
self.restore = restore
self.private_endpoint_connections = private_endpoint_connections
self.platform_version = None
+ self.legacy_portal_status = legacy_portal_status
+ self.developer_portal_status = developer_portal_status
+ self.release_channel = release_channel
self.publisher_email = publisher_email
self.publisher_name = publisher_name
@@ -3647,6 +4478,8 @@ class ApiManagementServiceUpdateProperties(
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :ivar configuration_api: Configuration API configuration of the API Management service.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:ivar virtual_network_configuration: Virtual network configuration of the API Management
service.
:vartype virtual_network_configuration:
@@ -3676,7 +4509,7 @@ class ApiManagementServiceUpdateProperties(
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`:\
+ `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\\
``false``. The default value is ``true`` for them. Note: The following ciphers can't be
disabled since they are required by internal platform components:
TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,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. # pylint: disable=line-too-long
@@ -3714,8 +4547,17 @@ class ApiManagementServiceUpdateProperties(
:vartype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
:ivar platform_version: Compute Platform Version running the service in this location. Known
- values are: "undetermined", "stv1", "stv2", and "mtv1".
+ values are: "undetermined", "stv1", "stv2", "mtv1", and "stv2.1".
:vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion
+ :ivar legacy_portal_status: Status of legacy portal in the API Management service. Known values
+ are: "Enabled" and "Disabled".
+ :vartype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :ivar developer_portal_status: Status of developer portal in this API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :vartype developer_portal_status: str or ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
+ :ivar release_channel: Release Channel of this API Management service. Known values are:
+ "Preview", "Default", and "Stable".
+ :vartype release_channel: str or ~azure.mgmt.apimanagement.models.ReleaseChannel
:ivar publisher_email: Publisher email.
:vartype publisher_email: str
:ivar publisher_name: Publisher name.
@@ -3757,6 +4599,7 @@ class ApiManagementServiceUpdateProperties(
"private_ip_addresses": {"key": "privateIPAddresses", "type": "[str]"},
"public_ip_address_id": {"key": "publicIpAddressId", "type": "str"},
"public_network_access": {"key": "publicNetworkAccess", "type": "str"},
+ "configuration_api": {"key": "configurationApi", "type": "ConfigurationApi"},
"virtual_network_configuration": {"key": "virtualNetworkConfiguration", "type": "VirtualNetworkConfiguration"},
"additional_locations": {"key": "additionalLocations", "type": "[AdditionalLocation]"},
"custom_properties": {"key": "customProperties", "type": "{str}"},
@@ -3773,6 +4616,9 @@ class ApiManagementServiceUpdateProperties(
"type": "[RemotePrivateEndpointConnectionWrapper]",
},
"platform_version": {"key": "platformVersion", "type": "str"},
+ "legacy_portal_status": {"key": "legacyPortalStatus", "type": "str"},
+ "developer_portal_status": {"key": "developerPortalStatus", "type": "str"},
+ "release_channel": {"key": "releaseChannel", "type": "str"},
"publisher_email": {"key": "publisherEmail", "type": "str"},
"publisher_name": {"key": "publisherName", "type": "str"},
}
@@ -3784,6 +4630,7 @@ def __init__( # pylint: disable=too-many-locals
hostname_configurations: Optional[List["_models.HostnameConfiguration"]] = None,
public_ip_address_id: Optional[str] = None,
public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None,
+ configuration_api: Optional["_models.ConfigurationApi"] = None,
virtual_network_configuration: Optional["_models.VirtualNetworkConfiguration"] = None,
additional_locations: Optional[List["_models.AdditionalLocation"]] = None,
custom_properties: Optional[Dict[str, str]] = None,
@@ -3791,10 +4638,13 @@ def __init__( # pylint: disable=too-many-locals
enable_client_certificate: bool = False,
nat_gateway_state: Optional[Union[str, "_models.NatGatewayState"]] = None,
disable_gateway: bool = False,
- virtual_network_type: Union[str, "_models.VirtualNetworkType"] = "None",
+ virtual_network_type: Optional[Union[str, "_models.VirtualNetworkType"]] = None,
api_version_constraint: Optional["_models.ApiVersionConstraint"] = None,
restore: bool = False,
private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None,
+ legacy_portal_status: Union[str, "_models.LegacyPortalStatus"] = "Enabled",
+ developer_portal_status: Union[str, "_models.DeveloperPortalStatus"] = "Enabled",
+ release_channel: Optional[Union[str, "_models.ReleaseChannel"]] = None,
publisher_email: Optional[str] = None,
publisher_name: Optional[str] = None,
**kwargs: Any
@@ -3814,6 +4664,8 @@ def __init__( # pylint: disable=too-many-locals
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :keyword configuration_api: Configuration API configuration of the API Management service.
+ :paramtype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:keyword virtual_network_configuration: Virtual network configuration of the API Management
service.
:paramtype virtual_network_configuration:
@@ -3843,7 +4695,7 @@ def __init__( # pylint: disable=too-many-locals
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`:\
+ `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\\
``false``. The default value is ``true`` for them. Note: The following ciphers can't be
disabled since they are required by internal platform components:
TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,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. # pylint: disable=line-too-long
@@ -3877,6 +4729,16 @@ def __init__( # pylint: disable=too-many-locals
:keyword private_endpoint_connections: List of Private Endpoint Connections of this service.
:paramtype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
+ :keyword legacy_portal_status: Status of legacy portal in the API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :paramtype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :keyword developer_portal_status: Status of developer portal in this API Management service.
+ Known values are: "Enabled" and "Disabled".
+ :paramtype developer_portal_status: str or
+ ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
+ :keyword release_channel: Release Channel of this API Management service. Known values are:
+ "Preview", "Default", and "Stable".
+ :paramtype release_channel: str or ~azure.mgmt.apimanagement.models.ReleaseChannel
:keyword publisher_email: Publisher email.
:paramtype publisher_email: str
:keyword publisher_name: Publisher name.
@@ -3887,6 +4749,7 @@ def __init__( # pylint: disable=too-many-locals
hostname_configurations=hostname_configurations,
public_ip_address_id=public_ip_address_id,
public_network_access=public_network_access,
+ configuration_api=configuration_api,
virtual_network_configuration=virtual_network_configuration,
additional_locations=additional_locations,
custom_properties=custom_properties,
@@ -3898,6 +4761,9 @@ def __init__( # pylint: disable=too-many-locals
api_version_constraint=api_version_constraint,
restore=restore,
private_endpoint_connections=private_endpoint_connections,
+ legacy_portal_status=legacy_portal_status,
+ developer_portal_status=developer_portal_status,
+ release_channel=release_channel,
**kwargs
)
self.publisher_email = publisher_email
@@ -3914,7 +4780,7 @@ class ApiManagementSku(_serialization.Model): # pylint: disable=too-many-instan
:ivar name: The name of SKU.
:vartype name: str
:ivar tier: Specifies the tier of virtual machines in a scale set.:code:`
`:code:`
`
- Possible Values::code:`
`:code:`
` **Standard**\ :code:`
`:code:`
`
+ Possible Values::code:`
`:code:`
` **Standard**\\ :code:`
`:code:`
`
**Basic**.
:vartype tier: str
:ivar size: The Size of the SKU.
@@ -4256,6 +5122,144 @@ def __init__(self, **kwargs: Any) -> None:
self.capabilities = None
+class ApiManagementWorkspaceLinksListResult(_serialization.Model):
+ """The response of the List API Management WorkspaceLink operation.
+
+ All required parameters must be populated in order to send to server.
+
+ :ivar value: Result of the List API Management WorkspaceLinks operation. Required.
+ :vartype value: list[~azure.mgmt.apimanagement.models.ApiManagementWorkspaceLinksResource]
+ :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list
+ of API Management services.
+ :vartype next_link: str
+ """
+
+ _validation = {
+ "value": {"required": True},
+ }
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[ApiManagementWorkspaceLinksResource]"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: List["_models.ApiManagementWorkspaceLinksResource"],
+ next_link: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: Result of the List API Management WorkspaceLinks operation. Required.
+ :paramtype value: list[~azure.mgmt.apimanagement.models.ApiManagementWorkspaceLinksResource]
+ :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().__init__(**kwargs)
+ self.value = value
+ self.next_link = next_link
+
+
+class WorkspaceLinksBaseProperties(_serialization.Model):
+ """WorkspaceLinksBaseProperties.
+
+ :ivar workspace_id: The link to the API Management service workspace.
+ :vartype workspace_id: str
+ :ivar gateways: The array of linked gateways.
+ :vartype gateways: list[~azure.mgmt.apimanagement.models.WorkspaceLinksGateway]
+ """
+
+ _attribute_map = {
+ "workspace_id": {"key": "workspaceId", "type": "str"},
+ "gateways": {"key": "gateways", "type": "[WorkspaceLinksGateway]"},
+ }
+
+ def __init__(
+ self,
+ *,
+ workspace_id: Optional[str] = None,
+ gateways: Optional[List["_models.WorkspaceLinksGateway"]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword workspace_id: The link to the API Management service workspace.
+ :paramtype workspace_id: str
+ :keyword gateways: The array of linked gateways.
+ :paramtype gateways: list[~azure.mgmt.apimanagement.models.WorkspaceLinksGateway]
+ """
+ super().__init__(**kwargs)
+ self.workspace_id = workspace_id
+ self.gateways = gateways
+
+
+class ApiManagementWorkspaceLinksProperties(WorkspaceLinksBaseProperties):
+ """Properties of an API Management workspaceLinks resource.
+
+ :ivar workspace_id: The link to the API Management service workspace.
+ :vartype workspace_id: str
+ :ivar gateways: The array of linked gateways.
+ :vartype gateways: list[~azure.mgmt.apimanagement.models.WorkspaceLinksGateway]
+ """
+
+
+class ApiManagementWorkspaceLinksResource(ProxyResource):
+ """A single API Management WorkspaceLinks in List or Get response.
+
+ 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}. # pylint: disable=line-too-long
+ :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 etag: ETag of the resource.
+ :vartype etag: str
+ :ivar workspace_id: The link to the API Management service workspace.
+ :vartype workspace_id: str
+ :ivar gateways: The array of linked gateways.
+ :vartype gateways: list[~azure.mgmt.apimanagement.models.WorkspaceLinksGateway]
+ """
+
+ _validation = {
+ "id": {"readonly": True},
+ "name": {"readonly": True},
+ "type": {"readonly": True},
+ "etag": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ "name": {"key": "name", "type": "str"},
+ "type": {"key": "type", "type": "str"},
+ "etag": {"key": "etag", "type": "str"},
+ "workspace_id": {"key": "properties.workspaceId", "type": "str"},
+ "gateways": {"key": "properties.gateways", "type": "[WorkspaceLinksGateway]"},
+ }
+
+ def __init__(
+ self,
+ *,
+ workspace_id: Optional[str] = None,
+ gateways: Optional[List["_models.WorkspaceLinksGateway"]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword workspace_id: The link to the API Management service workspace.
+ :paramtype workspace_id: str
+ :keyword gateways: The array of linked gateways.
+ :paramtype gateways: list[~azure.mgmt.apimanagement.models.WorkspaceLinksGateway]
+ """
+ super().__init__(**kwargs)
+ self.etag = None
+ self.workspace_id = workspace_id
+ self.gateways = gateways
+
+
class ApiReleaseCollection(_serialization.Model):
"""Paged ApiRelease list representation.
@@ -4506,7 +5510,8 @@ class ApiTagResourceContractProperties(ApiEntityBaseContract): # pylint: disabl
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
: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.
@@ -4617,7 +5622,8 @@ def __init__(
: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. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
: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.
@@ -4692,7 +5698,8 @@ class ApiUpdateContract(_serialization.Model): # pylint: disable=too-many-insta
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
: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.
@@ -4802,7 +5809,8 @@ def __init__(
: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. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
: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.
@@ -5493,6 +6501,8 @@ class AuthorizationAccessPolicyContract(ProxyResource):
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
+ :ivar app_ids: The allowed Azure Active Directory Application IDs.
+ :vartype app_ids: list[str]
:ivar tenant_id: The Tenant Id.
:vartype tenant_id: str
:ivar object_id: The Object Id.
@@ -5509,18 +6519,29 @@ class AuthorizationAccessPolicyContract(ProxyResource):
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
+ "app_ids": {"key": "properties.appIds", "type": "[str]"},
"tenant_id": {"key": "properties.tenantId", "type": "str"},
"object_id": {"key": "properties.objectId", "type": "str"},
}
- def __init__(self, *, tenant_id: Optional[str] = None, object_id: Optional[str] = None, **kwargs: Any) -> None:
+ def __init__(
+ self,
+ *,
+ app_ids: Optional[List[str]] = None,
+ tenant_id: Optional[str] = None,
+ object_id: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
"""
+ :keyword app_ids: The allowed Azure Active Directory Application IDs.
+ :paramtype app_ids: list[str]
:keyword tenant_id: The Tenant Id.
:paramtype tenant_id: str
:keyword object_id: The Object Id.
:paramtype object_id: str
"""
super().__init__(**kwargs)
+ self.app_ids = app_ids
self.tenant_id = tenant_id
self.object_id = object_id
@@ -6984,6 +8005,13 @@ class BackendBaseParameters(_serialization.Model):
:vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:ivar tls: Backend TLS Properties.
:vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :ivar circuit_breaker: Backend Circuit Breaker Configuration.
+ :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :ivar pool:
+ :vartype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :ivar type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :vartype type: str or ~azure.mgmt.apimanagement.models.BackendType
"""
_validation = {
@@ -7000,6 +8028,9 @@ class BackendBaseParameters(_serialization.Model):
"credentials": {"key": "credentials", "type": "BackendCredentialsContract"},
"proxy": {"key": "proxy", "type": "BackendProxyContract"},
"tls": {"key": "tls", "type": "BackendTlsProperties"},
+ "circuit_breaker": {"key": "circuitBreaker", "type": "BackendCircuitBreaker"},
+ "pool": {"key": "pool", "type": "BackendBaseParametersPool"},
+ "type": {"key": "type", "type": "str"},
}
def __init__(
@@ -7012,6 +8043,9 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
+ pool: Optional["_models.BackendBaseParametersPool"] = None,
+ type: Optional[Union[str, "_models.BackendType"]] = None,
**kwargs: Any
) -> None:
"""
@@ -7030,6 +8064,13 @@ def __init__(
:paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:keyword tls: Backend TLS Properties.
:paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :keyword circuit_breaker: Backend Circuit Breaker Configuration.
+ :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :keyword pool:
+ :paramtype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :keyword type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :paramtype type: str or ~azure.mgmt.apimanagement.models.BackendType
"""
super().__init__(**kwargs)
self.title = title
@@ -7039,6 +8080,65 @@ def __init__(
self.credentials = credentials
self.proxy = proxy
self.tls = tls
+ self.circuit_breaker = circuit_breaker
+ self.pool = pool
+ self.type = type
+
+
+class BackendPool(_serialization.Model):
+ """Backend pool information.
+
+ :ivar services: The list of backend entities belonging to a pool.
+ :vartype services: list[~azure.mgmt.apimanagement.models.BackendPoolItem]
+ """
+
+ _validation = {
+ "services": {"min_items": 1},
+ }
+
+ _attribute_map = {
+ "services": {"key": "services", "type": "[BackendPoolItem]"},
+ }
+
+ def __init__(self, *, services: Optional[List["_models.BackendPoolItem"]] = None, **kwargs: Any) -> None:
+ """
+ :keyword services: The list of backend entities belonging to a pool.
+ :paramtype services: list[~azure.mgmt.apimanagement.models.BackendPoolItem]
+ """
+ super().__init__(**kwargs)
+ self.services = services
+
+
+class BackendBaseParametersPool(BackendPool):
+ """BackendBaseParametersPool.
+
+ :ivar services: The list of backend entities belonging to a pool.
+ :vartype services: list[~azure.mgmt.apimanagement.models.BackendPoolItem]
+ """
+
+
+class BackendCircuitBreaker(_serialization.Model):
+ """The configuration of the backend circuit breaker.
+
+ :ivar rules: The rules for tripping the backend.
+ :vartype rules: list[~azure.mgmt.apimanagement.models.CircuitBreakerRule]
+ """
+
+ _validation = {
+ "rules": {"max_items": 15, "min_items": 0},
+ }
+
+ _attribute_map = {
+ "rules": {"key": "rules", "type": "[CircuitBreakerRule]"},
+ }
+
+ def __init__(self, *, rules: Optional[List["_models.CircuitBreakerRule"]] = None, **kwargs: Any) -> None:
+ """
+ :keyword rules: The rules for tripping the backend.
+ :paramtype rules: list[~azure.mgmt.apimanagement.models.CircuitBreakerRule]
+ """
+ super().__init__(**kwargs)
+ self.rules = rules
class BackendCollection(_serialization.Model):
@@ -7080,6 +8180,26 @@ def __init__(
self.next_link = next_link
+class BackendConfiguration(_serialization.Model):
+ """Information regarding how the gateway should integrate with backend systems.
+
+ :ivar subnet: The default hostname of the data-plane gateway to which requests can be sent.
+ :vartype subnet: ~azure.mgmt.apimanagement.models.BackendSubnetConfiguration
+ """
+
+ _attribute_map = {
+ "subnet": {"key": "subnet", "type": "BackendSubnetConfiguration"},
+ }
+
+ def __init__(self, *, subnet: Optional["_models.BackendSubnetConfiguration"] = None, **kwargs: Any) -> None:
+ """
+ :keyword subnet: The default hostname of the data-plane gateway to which requests can be sent.
+ :paramtype subnet: ~azure.mgmt.apimanagement.models.BackendSubnetConfiguration
+ """
+ super().__init__(**kwargs)
+ self.subnet = subnet
+
+
class BackendContract(ProxyResource): # pylint: disable=too-many-instance-attributes
"""Backend details.
@@ -7108,6 +8228,13 @@ class BackendContract(ProxyResource): # pylint: disable=too-many-instance-attri
:vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:ivar tls: Backend TLS Properties.
:vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :ivar circuit_breaker: Backend Circuit Breaker Configuration.
+ :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :ivar pool:
+ :vartype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :ivar type_properties_type: Type of the backend. A backend can be either Single or Pool. Known
+ values are: "Single" and "Pool".
+ :vartype type_properties_type: str or ~azure.mgmt.apimanagement.models.BackendType
:ivar url: Runtime Url of the Backend.
:vartype url: str
:ivar protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7135,6 +8262,9 @@ class BackendContract(ProxyResource): # pylint: disable=too-many-instance-attri
"credentials": {"key": "properties.credentials", "type": "BackendCredentialsContract"},
"proxy": {"key": "properties.proxy", "type": "BackendProxyContract"},
"tls": {"key": "properties.tls", "type": "BackendTlsProperties"},
+ "circuit_breaker": {"key": "properties.circuitBreaker", "type": "BackendCircuitBreaker"},
+ "pool": {"key": "properties.pool", "type": "BackendBaseParametersPool"},
+ "type_properties_type": {"key": "properties.type", "type": "str"},
"url": {"key": "properties.url", "type": "str"},
"protocol": {"key": "properties.protocol", "type": "str"},
}
@@ -7149,6 +8279,9 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
+ pool: Optional["_models.BackendBaseParametersPool"] = None,
+ type_properties_type: Optional[Union[str, "_models.BackendType"]] = None,
url: Optional[str] = None,
protocol: Optional[Union[str, "_models.BackendProtocol"]] = None,
**kwargs: Any
@@ -7169,6 +8302,13 @@ def __init__(
:paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:keyword tls: Backend TLS Properties.
:paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :keyword circuit_breaker: Backend Circuit Breaker Configuration.
+ :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :keyword pool:
+ :paramtype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :keyword type_properties_type: Type of the backend. A backend can be either Single or Pool.
+ Known values are: "Single" and "Pool".
+ :paramtype type_properties_type: str or ~azure.mgmt.apimanagement.models.BackendType
:keyword url: Runtime Url of the Backend.
:paramtype url: str
:keyword protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7182,11 +8322,14 @@ def __init__(
self.credentials = credentials
self.proxy = proxy
self.tls = tls
+ self.circuit_breaker = circuit_breaker
+ self.pool = pool
+ self.type_properties_type = type_properties_type
self.url = url
self.protocol = protocol
-class BackendContractProperties(BackendBaseParameters):
+class BackendContractProperties(BackendBaseParameters): # pylint: disable=too-many-instance-attributes
"""Parameters supplied to the Create Backend operation.
All required parameters must be populated in order to send to server.
@@ -7206,6 +8349,13 @@ class BackendContractProperties(BackendBaseParameters):
:vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:ivar tls: Backend TLS Properties.
:vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :ivar circuit_breaker: Backend Circuit Breaker Configuration.
+ :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :ivar pool:
+ :vartype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :ivar type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :vartype type: str or ~azure.mgmt.apimanagement.models.BackendType
:ivar url: Runtime Url of the Backend. Required.
:vartype url: str
:ivar protocol: Backend communication protocol. Required. Known values are: "http" and "soap".
@@ -7228,6 +8378,9 @@ class BackendContractProperties(BackendBaseParameters):
"credentials": {"key": "credentials", "type": "BackendCredentialsContract"},
"proxy": {"key": "proxy", "type": "BackendProxyContract"},
"tls": {"key": "tls", "type": "BackendTlsProperties"},
+ "circuit_breaker": {"key": "circuitBreaker", "type": "BackendCircuitBreaker"},
+ "pool": {"key": "pool", "type": "BackendBaseParametersPool"},
+ "type": {"key": "type", "type": "str"},
"url": {"key": "url", "type": "str"},
"protocol": {"key": "protocol", "type": "str"},
}
@@ -7244,6 +8397,9 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
+ pool: Optional["_models.BackendBaseParametersPool"] = None,
+ type: Optional[Union[str, "_models.BackendType"]] = None,
**kwargs: Any
) -> None:
"""
@@ -7262,6 +8418,13 @@ def __init__(
:paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:keyword tls: Backend TLS Properties.
:paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :keyword circuit_breaker: Backend Circuit Breaker Configuration.
+ :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :keyword pool:
+ :paramtype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :keyword type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :paramtype type: str or ~azure.mgmt.apimanagement.models.BackendType
:keyword url: Runtime Url of the Backend. Required.
:paramtype url: str
:keyword protocol: Backend communication protocol. Required. Known values are: "http" and
@@ -7276,6 +8439,9 @@ def __init__(
credentials=credentials,
proxy=proxy,
tls=tls,
+ circuit_breaker=circuit_breaker,
+ pool=pool,
+ type=type,
**kwargs
)
self.url = url
@@ -7343,6 +8509,59 @@ def __init__(
self.authorization = authorization
+class BackendPoolItem(_serialization.Model):
+ """Backend pool service information.
+
+ All required parameters must be populated in order to send to server.
+
+ :ivar id: The unique ARM id of the backend entity. The ARM id should refer to an already
+ existing backend entity. Required.
+ :vartype id: str
+ :ivar weight: The weight of the backend entity in the backend pool. Must be between 0 and 100.
+ It can be also null if the value not specified.
+ :vartype weight: int
+ :ivar priority: The priority of the backend entity in the backend pool. Must be between 0 and
+ 100. It can be also null if the value not specified.
+ :vartype priority: int
+ """
+
+ _validation = {
+ "id": {"required": True},
+ "weight": {"maximum": 100, "minimum": 0},
+ "priority": {"maximum": 100, "minimum": 0},
+ }
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ "weight": {"key": "weight", "type": "int"},
+ "priority": {"key": "priority", "type": "int"},
+ }
+
+ def __init__(
+ self,
+ *,
+ id: str, # pylint: disable=redefined-builtin
+ weight: Optional[int] = None,
+ priority: Optional[int] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword id: The unique ARM id of the backend entity. The ARM id should refer to an already
+ existing backend entity. Required.
+ :paramtype id: str
+ :keyword weight: The weight of the backend entity in the backend pool. Must be between 0 and
+ 100. It can be also null if the value not specified.
+ :paramtype weight: int
+ :keyword priority: The priority of the backend entity in the backend pool. Must be between 0
+ and 100. It can be also null if the value not specified.
+ :paramtype priority: int
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.weight = weight
+ self.priority = priority
+
+
class BackendProperties(_serialization.Model):
"""Properties specific to the Backend Type.
@@ -7522,6 +8741,26 @@ def __init__(
self.server_x509_names = server_x509_names
+class BackendSubnetConfiguration(_serialization.Model):
+ """Information regarding how the subnet to which the gateway should be injected.
+
+ :ivar id: The ARM ID of the subnet in which the backend systems are hosted.
+ :vartype id: str
+ """
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ }
+
+ def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin
+ """
+ :keyword id: The ARM ID of the subnet in which the backend systems are hosted.
+ :paramtype id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
class BackendTlsProperties(_serialization.Model):
"""Properties controlling TLS Certificate Validation.
@@ -7554,7 +8793,7 @@ def __init__(
self.validate_certificate_name = validate_certificate_name
-class BackendUpdateParameterProperties(BackendBaseParameters):
+class BackendUpdateParameterProperties(BackendBaseParameters): # pylint: disable=too-many-instance-attributes
"""Parameters supplied to the Update Backend operation.
:ivar title: Backend Title.
@@ -7572,6 +8811,13 @@ class BackendUpdateParameterProperties(BackendBaseParameters):
:vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:ivar tls: Backend TLS Properties.
:vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :ivar circuit_breaker: Backend Circuit Breaker Configuration.
+ :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :ivar pool:
+ :vartype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :ivar type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :vartype type: str or ~azure.mgmt.apimanagement.models.BackendType
:ivar url: Runtime Url of the Backend.
:vartype url: str
:ivar protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7593,6 +8839,9 @@ class BackendUpdateParameterProperties(BackendBaseParameters):
"credentials": {"key": "credentials", "type": "BackendCredentialsContract"},
"proxy": {"key": "proxy", "type": "BackendProxyContract"},
"tls": {"key": "tls", "type": "BackendTlsProperties"},
+ "circuit_breaker": {"key": "circuitBreaker", "type": "BackendCircuitBreaker"},
+ "pool": {"key": "pool", "type": "BackendBaseParametersPool"},
+ "type": {"key": "type", "type": "str"},
"url": {"key": "url", "type": "str"},
"protocol": {"key": "protocol", "type": "str"},
}
@@ -7607,6 +8856,9 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
+ pool: Optional["_models.BackendBaseParametersPool"] = None,
+ type: Optional[Union[str, "_models.BackendType"]] = None,
url: Optional[str] = None,
protocol: Optional[Union[str, "_models.BackendProtocol"]] = None,
**kwargs: Any
@@ -7627,6 +8879,13 @@ def __init__(
:paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:keyword tls: Backend TLS Properties.
:paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :keyword circuit_breaker: Backend Circuit Breaker Configuration.
+ :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :keyword pool:
+ :paramtype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :keyword type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :paramtype type: str or ~azure.mgmt.apimanagement.models.BackendType
:keyword url: Runtime Url of the Backend.
:paramtype url: str
:keyword protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7640,13 +8899,16 @@ def __init__(
credentials=credentials,
proxy=proxy,
tls=tls,
+ circuit_breaker=circuit_breaker,
+ pool=pool,
+ type=type,
**kwargs
)
self.url = url
self.protocol = protocol
-class BackendUpdateParameters(_serialization.Model):
+class BackendUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes
"""Backend update parameters.
:ivar title: Backend Title.
@@ -7664,6 +8926,13 @@ class BackendUpdateParameters(_serialization.Model):
:vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:ivar tls: Backend TLS Properties.
:vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :ivar circuit_breaker: Backend Circuit Breaker Configuration.
+ :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :ivar pool:
+ :vartype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :ivar type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :vartype type: str or ~azure.mgmt.apimanagement.models.BackendType
:ivar url: Runtime Url of the Backend.
:vartype url: str
:ivar protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7685,6 +8954,9 @@ class BackendUpdateParameters(_serialization.Model):
"credentials": {"key": "properties.credentials", "type": "BackendCredentialsContract"},
"proxy": {"key": "properties.proxy", "type": "BackendProxyContract"},
"tls": {"key": "properties.tls", "type": "BackendTlsProperties"},
+ "circuit_breaker": {"key": "properties.circuitBreaker", "type": "BackendCircuitBreaker"},
+ "pool": {"key": "properties.pool", "type": "BackendBaseParametersPool"},
+ "type": {"key": "properties.type", "type": "str"},
"url": {"key": "properties.url", "type": "str"},
"protocol": {"key": "properties.protocol", "type": "str"},
}
@@ -7699,6 +8971,9 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
+ pool: Optional["_models.BackendBaseParametersPool"] = None,
+ type: Optional[Union[str, "_models.BackendType"]] = None,
url: Optional[str] = None,
protocol: Optional[Union[str, "_models.BackendProtocol"]] = None,
**kwargs: Any
@@ -7719,6 +8994,13 @@ def __init__(
:paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:keyword tls: Backend TLS Properties.
:paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :keyword circuit_breaker: Backend Circuit Breaker Configuration.
+ :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :keyword pool:
+ :paramtype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :keyword type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :paramtype type: str or ~azure.mgmt.apimanagement.models.BackendType
:keyword url: Runtime Url of the Backend.
:paramtype url: str
:keyword protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7732,6 +9014,9 @@ def __init__(
self.credentials = credentials
self.proxy = proxy
self.tls = tls
+ self.circuit_breaker = circuit_breaker
+ self.pool = pool
+ self.type = type
self.url = url
self.protocol = protocol
@@ -8141,32 +9426,136 @@ class CertificateInformation(_serialization.Model):
:vartype subject: str
"""
- _validation = {
- "expiry": {"required": True},
- "thumbprint": {"required": True},
- "subject": {"required": True},
- }
+ _validation = {
+ "expiry": {"required": True},
+ "thumbprint": {"required": True},
+ "subject": {"required": True},
+ }
+
+ _attribute_map = {
+ "expiry": {"key": "expiry", "type": "iso-8601"},
+ "thumbprint": {"key": "thumbprint", "type": "str"},
+ "subject": {"key": "subject", "type": "str"},
+ }
+
+ def __init__(self, *, expiry: datetime.datetime, thumbprint: str, subject: str, **kwargs: Any) -> None:
+ """
+ :keyword expiry: Expiration date of the certificate. The date conforms to the following format:
+ ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. Required.
+ :paramtype expiry: ~datetime.datetime
+ :keyword thumbprint: Thumbprint of the certificate. Required.
+ :paramtype thumbprint: str
+ :keyword subject: Subject of the certificate. Required.
+ :paramtype subject: str
+ """
+ super().__init__(**kwargs)
+ self.expiry = expiry
+ self.thumbprint = thumbprint
+ self.subject = subject
+
+
+class CircuitBreakerFailureCondition(_serialization.Model):
+ """The trip conditions of the circuit breaker.
+
+ :ivar count: The threshold for opening the circuit.
+ :vartype count: int
+ :ivar percentage: The threshold for opening the circuit.
+ :vartype percentage: int
+ :ivar interval: The interval during which the failures are counted.
+ :vartype interval: ~datetime.timedelta
+ :ivar status_code_ranges: The status code ranges which are considered as failure.
+ :vartype status_code_ranges: list[~azure.mgmt.apimanagement.models.FailureStatusCodeRange]
+ :ivar error_reasons: The error reasons which are considered as failure.
+ :vartype error_reasons: list[str]
+ """
+
+ _validation = {
+ "status_code_ranges": {"max_items": 10, "min_items": 0},
+ "error_reasons": {"max_items": 10, "min_items": 0},
+ }
+
+ _attribute_map = {
+ "count": {"key": "count", "type": "int"},
+ "percentage": {"key": "percentage", "type": "int"},
+ "interval": {"key": "interval", "type": "duration"},
+ "status_code_ranges": {"key": "statusCodeRanges", "type": "[FailureStatusCodeRange]"},
+ "error_reasons": {"key": "errorReasons", "type": "[str]"},
+ }
+
+ def __init__(
+ self,
+ *,
+ count: Optional[int] = None,
+ percentage: Optional[int] = None,
+ interval: Optional[datetime.timedelta] = None,
+ status_code_ranges: Optional[List["_models.FailureStatusCodeRange"]] = None,
+ error_reasons: Optional[List[str]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword count: The threshold for opening the circuit.
+ :paramtype count: int
+ :keyword percentage: The threshold for opening the circuit.
+ :paramtype percentage: int
+ :keyword interval: The interval during which the failures are counted.
+ :paramtype interval: ~datetime.timedelta
+ :keyword status_code_ranges: The status code ranges which are considered as failure.
+ :paramtype status_code_ranges: list[~azure.mgmt.apimanagement.models.FailureStatusCodeRange]
+ :keyword error_reasons: The error reasons which are considered as failure.
+ :paramtype error_reasons: list[str]
+ """
+ super().__init__(**kwargs)
+ self.count = count
+ self.percentage = percentage
+ self.interval = interval
+ self.status_code_ranges = status_code_ranges
+ self.error_reasons = error_reasons
+
+
+class CircuitBreakerRule(_serialization.Model):
+ """Rule configuration to trip the backend.
+
+ :ivar name: The rule name.
+ :vartype name: str
+ :ivar failure_condition: The conditions for tripping the circuit breaker.
+ :vartype failure_condition: ~azure.mgmt.apimanagement.models.CircuitBreakerFailureCondition
+ :ivar trip_duration: The duration for which the circuit will be tripped.
+ :vartype trip_duration: ~datetime.timedelta
+ :ivar accept_retry_after: flag to accept Retry-After header from the backend.
+ :vartype accept_retry_after: bool
+ """
_attribute_map = {
- "expiry": {"key": "expiry", "type": "iso-8601"},
- "thumbprint": {"key": "thumbprint", "type": "str"},
- "subject": {"key": "subject", "type": "str"},
+ "name": {"key": "name", "type": "str"},
+ "failure_condition": {"key": "failureCondition", "type": "CircuitBreakerFailureCondition"},
+ "trip_duration": {"key": "tripDuration", "type": "duration"},
+ "accept_retry_after": {"key": "acceptRetryAfter", "type": "bool"},
}
- def __init__(self, *, expiry: datetime.datetime, thumbprint: str, subject: str, **kwargs: Any) -> None:
+ def __init__(
+ self,
+ *,
+ name: Optional[str] = None,
+ failure_condition: Optional["_models.CircuitBreakerFailureCondition"] = None,
+ trip_duration: Optional[datetime.timedelta] = None,
+ accept_retry_after: Optional[bool] = None,
+ **kwargs: Any
+ ) -> None:
"""
- :keyword expiry: Expiration date of the certificate. The date conforms to the following format:
- ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. Required.
- :paramtype expiry: ~datetime.datetime
- :keyword thumbprint: Thumbprint of the certificate. Required.
- :paramtype thumbprint: str
- :keyword subject: Subject of the certificate. Required.
- :paramtype subject: str
+ :keyword name: The rule name.
+ :paramtype name: str
+ :keyword failure_condition: The conditions for tripping the circuit breaker.
+ :paramtype failure_condition: ~azure.mgmt.apimanagement.models.CircuitBreakerFailureCondition
+ :keyword trip_duration: The duration for which the circuit will be tripped.
+ :paramtype trip_duration: ~datetime.timedelta
+ :keyword accept_retry_after: flag to accept Retry-After header from the backend.
+ :paramtype accept_retry_after: bool
"""
super().__init__(**kwargs)
- self.expiry = expiry
- self.thumbprint = thumbprint
- self.subject = subject
+ self.name = name
+ self.failure_condition = failure_condition
+ self.trip_duration = trip_duration
+ self.accept_retry_after = accept_retry_after
class ClientSecretContract(_serialization.Model):
@@ -8189,6 +9578,32 @@ def __init__(self, *, client_secret: Optional[str] = None, **kwargs: Any) -> Non
self.client_secret = client_secret
+class ConfigurationApi(_serialization.Model):
+ """Information regarding the Configuration API of the API Management service.
+
+ :ivar legacy_api: Indication whether or not the legacy Configuration API (v1) should be exposed
+ on the API Management service. Value is optional but must be 'Enabled' or 'Disabled'. If
+ 'Disabled', legacy Configuration API (v1) will not be available for self-hosted gateways.
+ Default value is 'Enabled'. Known values are: "Enabled" and "Disabled".
+ :vartype legacy_api: str or ~azure.mgmt.apimanagement.models.LegacyApiState
+ """
+
+ _attribute_map = {
+ "legacy_api": {"key": "legacyApi", "type": "str"},
+ }
+
+ def __init__(self, *, legacy_api: Union[str, "_models.LegacyApiState"] = "Enabled", **kwargs: Any) -> None:
+ """
+ :keyword legacy_api: Indication whether or not the legacy Configuration API (v1) should be
+ exposed on the API Management service. Value is optional but must be 'Enabled' or 'Disabled'.
+ If 'Disabled', legacy Configuration API (v1) will not be available for self-hosted gateways.
+ Default value is 'Enabled'. Known values are: "Enabled" and "Disabled".
+ :paramtype legacy_api: str or ~azure.mgmt.apimanagement.models.LegacyApiState
+ """
+ super().__init__(**kwargs)
+ self.legacy_api = legacy_api
+
+
class ConnectivityCheckRequest(_serialization.Model):
"""A request to perform the connectivity check operation on a API Management service.
@@ -9036,6 +10451,132 @@ class DiagnosticContract(ProxyResource): # pylint: disable=too-many-instance-at
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}. # pylint: disable=line-too-long
+ :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 always_log: Specifies for what type of messages sampling settings should not apply.
+ "allErrors"
+ :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 large_language_model: Large Language Models diagnostic settings.
+ :vartype large_language_model: ~azure.mgmt.apimanagement.models.LLMDiagnosticSettings
+ :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. Known values are: "None", "Legacy", and "W3C".
+ :vartype http_correlation_protocol: str or
+ ~azure.mgmt.apimanagement.models.HttpCorrelationProtocol
+ :ivar verbosity: The verbosity level applied to traces emitted by trace policies. Known values
+ are: "verbose", "information", and "error".
+ :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. Known values are: "Name" and "Url".
+ :vartype operation_name_format: str or ~azure.mgmt.apimanagement.models.OperationNameFormat
+ :ivar metrics: Emit custom metrics via emit-metric policy. Applicable only to Application
+ Insights diagnostic settings.
+ :vartype metrics: 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"},
+ "always_log": {"key": "properties.alwaysLog", "type": "str"},
+ "logger_id": {"key": "properties.loggerId", "type": "str"},
+ "sampling": {"key": "properties.sampling", "type": "SamplingSettings"},
+ "frontend": {"key": "properties.frontend", "type": "PipelineDiagnosticSettings"},
+ "backend": {"key": "properties.backend", "type": "PipelineDiagnosticSettings"},
+ "large_language_model": {"key": "properties.largeLanguageModel", "type": "LLMDiagnosticSettings"},
+ "log_client_ip": {"key": "properties.logClientIp", "type": "bool"},
+ "http_correlation_protocol": {"key": "properties.httpCorrelationProtocol", "type": "str"},
+ "verbosity": {"key": "properties.verbosity", "type": "str"},
+ "operation_name_format": {"key": "properties.operationNameFormat", "type": "str"},
+ "metrics": {"key": "properties.metrics", "type": "bool"},
+ }
+
+ def __init__(
+ self,
+ *,
+ always_log: Optional[Union[str, "_models.AlwaysLog"]] = None,
+ logger_id: Optional[str] = None,
+ sampling: Optional["_models.SamplingSettings"] = None,
+ frontend: Optional["_models.PipelineDiagnosticSettings"] = None,
+ backend: Optional["_models.PipelineDiagnosticSettings"] = None,
+ large_language_model: Optional["_models.LLMDiagnosticSettings"] = None,
+ log_client_ip: Optional[bool] = None,
+ http_correlation_protocol: Optional[Union[str, "_models.HttpCorrelationProtocol"]] = None,
+ verbosity: Optional[Union[str, "_models.Verbosity"]] = None,
+ operation_name_format: Optional[Union[str, "_models.OperationNameFormat"]] = None,
+ metrics: Optional[bool] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword always_log: Specifies for what type of messages sampling settings should not apply.
+ "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 large_language_model: Large Language Models diagnostic settings.
+ :paramtype large_language_model: ~azure.mgmt.apimanagement.models.LLMDiagnosticSettings
+ :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. Known values are: "None", "Legacy", and "W3C".
+ :paramtype http_correlation_protocol: str or
+ ~azure.mgmt.apimanagement.models.HttpCorrelationProtocol
+ :keyword verbosity: The verbosity level applied to traces emitted by trace policies. Known
+ values are: "verbose", "information", and "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. Known values are: "Name" and "Url".
+ :paramtype operation_name_format: str or ~azure.mgmt.apimanagement.models.OperationNameFormat
+ :keyword metrics: Emit custom metrics via emit-metric policy. Applicable only to Application
+ Insights diagnostic settings.
+ :paramtype metrics: bool
+ """
+ super().__init__(**kwargs)
+ self.always_log = always_log
+ self.logger_id = logger_id
+ self.sampling = sampling
+ self.frontend = frontend
+ self.backend = backend
+ self.large_language_model = large_language_model
+ self.log_client_ip = log_client_ip
+ self.http_correlation_protocol = http_correlation_protocol
+ self.verbosity = verbosity
+ self.operation_name_format = operation_name_format
+ self.metrics = metrics
+
+
+class DiagnosticUpdateContract(ProxyResource): # pylint: disable=too-many-instance-attributes
+ """Diagnostic 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}. # pylint: disable=line-too-long
:vartype id: str
@@ -9533,6 +11074,77 @@ def __init__(self, *, port: Optional[int] = None, region: Optional[str] = None,
self.region = region
+class ErrorAdditionalInfo(_serialization.Model):
+ """The resource management error additional info.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar type: The additional info type.
+ :vartype type: str
+ :ivar info: The additional info.
+ :vartype info: JSON
+ """
+
+ _validation = {
+ "type": {"readonly": True},
+ "info": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "type": {"key": "type", "type": "str"},
+ "info": {"key": "info", "type": "object"},
+ }
+
+ def __init__(self, **kwargs: Any) -> None:
+ """ """
+ super().__init__(**kwargs)
+ self.type = None
+ self.info = None
+
+
+class ErrorDetail(_serialization.Model):
+ """The error detail.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar code: The error code.
+ :vartype code: str
+ :ivar message: The error message.
+ :vartype message: str
+ :ivar target: The error target.
+ :vartype target: str
+ :ivar details: The error details.
+ :vartype details: list[~azure.mgmt.apimanagement.models.ErrorDetail]
+ :ivar additional_info: The error additional info.
+ :vartype additional_info: list[~azure.mgmt.apimanagement.models.ErrorAdditionalInfo]
+ """
+
+ _validation = {
+ "code": {"readonly": True},
+ "message": {"readonly": True},
+ "target": {"readonly": True},
+ "details": {"readonly": True},
+ "additional_info": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "code": {"key": "code", "type": "str"},
+ "message": {"key": "message", "type": "str"},
+ "target": {"key": "target", "type": "str"},
+ "details": {"key": "details", "type": "[ErrorDetail]"},
+ "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"},
+ }
+
+ def __init__(self, **kwargs: Any) -> None:
+ """ """
+ super().__init__(**kwargs)
+ self.code = None
+ self.message = None
+ self.target = None
+ self.details = None
+ self.additional_info = None
+
+
class ErrorFieldContract(_serialization.Model):
"""Error Field contract.
@@ -9568,7 +11180,28 @@ def __init__(
class ErrorResponse(_serialization.Model):
- """Error Response.
+ """Common error response for all Azure Resource Manager APIs to return error details for failed
+ operations. (This also follows the OData error response format.).
+
+ :ivar error: The error object.
+ :vartype error: ~azure.mgmt.apimanagement.models.ErrorDetail
+ """
+
+ _attribute_map = {
+ "error": {"key": "error", "type": "ErrorDetail"},
+ }
+
+ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None:
+ """
+ :keyword error: The error object.
+ :paramtype error: ~azure.mgmt.apimanagement.models.ErrorDetail
+ """
+ super().__init__(**kwargs)
+ self.error = error
+
+
+class ErrorResponseBody(_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.
@@ -9580,9 +11213,9 @@ class ErrorResponse(_serialization.Model):
"""
_attribute_map = {
- "code": {"key": "error.code", "type": "str"},
- "message": {"key": "error.message", "type": "str"},
- "details": {"key": "error.details", "type": "[ErrorFieldContract]"},
+ "code": {"key": "code", "type": "str"},
+ "message": {"key": "message", "type": "str"},
+ "details": {"key": "details", "type": "[ErrorFieldContract]"},
}
def __init__(
@@ -9608,45 +11241,65 @@ def __init__(
self.details = details
-class ErrorResponseBody(_serialization.Model):
- """Error Body contract.
+class FailureStatusCodeRange(_serialization.Model):
+ """The failure http status code range.
- :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]
+ :ivar min: The minimum http status code.
+ :vartype min: int
+ :ivar max: The maximum http status code.
+ :vartype max: int
"""
+ _validation = {
+ "min": {"maximum": 599, "minimum": 200},
+ "max": {"maximum": 599, "minimum": 200},
+ }
+
_attribute_map = {
- "code": {"key": "code", "type": "str"},
- "message": {"key": "message", "type": "str"},
- "details": {"key": "details", "type": "[ErrorFieldContract]"},
+ "min": {"key": "min", "type": "int"},
+ "max": {"key": "max", "type": "int"},
}
def __init__(
self,
*,
- code: Optional[str] = None,
- message: Optional[str] = None,
- details: Optional[List["_models.ErrorFieldContract"]] = None,
+ min: Optional[int] = None, # pylint: disable=redefined-builtin
+ max: Optional[int] = None, # pylint: disable=redefined-builtin
**kwargs: Any
) -> None:
"""
- :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]
+ :keyword min: The minimum http status code.
+ :paramtype min: int
+ :keyword max: The maximum http status code.
+ :paramtype max: int
"""
super().__init__(**kwargs)
- self.code = code
- self.message = message
- self.details = details
+ self.min = min
+ self.max = max
+
+
+class FrontendConfiguration(_serialization.Model):
+ """Information regarding how the gateway should be exposed.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar default_hostname: The default hostname of the data-plane gateway to which requests can be
+ sent. This is only applicable for API gateway with Standard SKU.
+ :vartype default_hostname: str
+ """
+
+ _validation = {
+ "default_hostname": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "default_hostname": {"key": "defaultHostname", "type": "str"},
+ }
+
+ def __init__(self, **kwargs: Any) -> None:
+ """ """
+ super().__init__(**kwargs)
+ self.default_hostname = None
class GatewayCertificateAuthorityCollection(_serialization.Model):
@@ -9751,6 +11404,30 @@ def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None:
self.next_link = None
+class GatewayConfigurationApi(_serialization.Model):
+ """Information regarding the Configuration API of the API Management gateway. This is only
+ applicable for API gateway with Standard SKU.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar hostname: Hostname to which the agent connects to propagate configuration to the cloud.
+ :vartype hostname: str
+ """
+
+ _validation = {
+ "hostname": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "hostname": {"key": "hostname", "type": "str"},
+ }
+
+ def __init__(self, **kwargs: Any) -> None:
+ """ """
+ super().__init__(**kwargs)
+ self.hostname = None
+
+
class GatewayContract(ProxyResource):
"""Gateway details.
@@ -9803,6 +11480,26 @@ def __init__(
self.description = description
+class GatewayDebugCredentialsContract(_serialization.Model):
+ """Gateway debug credentials.
+
+ :ivar token: Gateway debug token.
+ :vartype token: str
+ """
+
+ _attribute_map = {
+ "token": {"key": "token", "type": "str"},
+ }
+
+ def __init__(self, *, token: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :keyword token: Gateway debug token.
+ :paramtype token: str
+ """
+ super().__init__(**kwargs)
+ self.token = token
+
+
class GatewayHostnameConfigurationCollection(_serialization.Model):
"""Paged Gateway hostname configuration list representation.
@@ -9966,6 +11663,204 @@ def __init__(self, *, primary: Optional[str] = None, secondary: Optional[str] =
self.secondary = secondary
+class GatewayListDebugCredentialsContract(_serialization.Model):
+ """List debug credentials properties.
+
+ All required parameters must be populated in order to send to server.
+
+ :ivar credentials_expire_after: Credentials expiration in ISO8601 format. Maximum duration of
+ the credentials is PT1H. When property is not specified, them value PT1H is used.
+ :vartype credentials_expire_after: ~datetime.timedelta
+ :ivar purposes: Purposes of debug credential. Required.
+ :vartype purposes: list[str or
+ ~azure.mgmt.apimanagement.models.GatewayListDebugCredentialsContractPurpose]
+ :ivar api_id: Full resource Id of an API. Required.
+ :vartype api_id: str
+ """
+
+ _validation = {
+ "purposes": {"required": True},
+ "api_id": {"required": True},
+ }
+
+ _attribute_map = {
+ "credentials_expire_after": {"key": "credentialsExpireAfter", "type": "duration"},
+ "purposes": {"key": "purposes", "type": "[str]"},
+ "api_id": {"key": "apiId", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ purposes: List[Union[str, "_models.GatewayListDebugCredentialsContractPurpose"]],
+ api_id: str,
+ credentials_expire_after: Optional[datetime.timedelta] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword credentials_expire_after: Credentials expiration in ISO8601 format. Maximum duration
+ of the credentials is PT1H. When property is not specified, them value PT1H is used.
+ :paramtype credentials_expire_after: ~datetime.timedelta
+ :keyword purposes: Purposes of debug credential. Required.
+ :paramtype purposes: list[str or
+ ~azure.mgmt.apimanagement.models.GatewayListDebugCredentialsContractPurpose]
+ :keyword api_id: Full resource Id of an API. Required.
+ :paramtype api_id: str
+ """
+ super().__init__(**kwargs)
+ self.credentials_expire_after = credentials_expire_after
+ self.purposes = purposes
+ self.api_id = api_id
+
+
+class GatewayListTraceContract(_serialization.Model):
+ """List trace properties.
+
+ :ivar trace_id: Trace id.
+ :vartype trace_id: str
+ """
+
+ _attribute_map = {
+ "trace_id": {"key": "traceId", "type": "str"},
+ }
+
+ def __init__(self, *, trace_id: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :keyword trace_id: Trace id.
+ :paramtype trace_id: str
+ """
+ super().__init__(**kwargs)
+ self.trace_id = trace_id
+
+
+class GatewayResourceSkuResult(_serialization.Model):
+ """Describes an available API Management gateway SKU.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar resource_type: The type of resource the SKU applies to.
+ :vartype resource_type: str
+ :ivar sku: Specifies API Management gateway SKU.
+ :vartype sku: ~azure.mgmt.apimanagement.models.GatewaySku
+ :ivar capacity: Specifies the number of API Management gateway units.
+ :vartype capacity: ~azure.mgmt.apimanagement.models.GatewaySkuCapacity
+ """
+
+ _validation = {
+ "resource_type": {"readonly": True},
+ "sku": {"readonly": True},
+ "capacity": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "resource_type": {"key": "resourceType", "type": "str"},
+ "sku": {"key": "sku", "type": "GatewaySku"},
+ "capacity": {"key": "capacity", "type": "GatewaySkuCapacity"},
+ }
+
+ def __init__(self, **kwargs: Any) -> None:
+ """ """
+ super().__init__(**kwargs)
+ self.resource_type = None
+ self.sku = None
+ self.capacity = None
+
+
+class GatewayResourceSkuResults(_serialization.Model):
+ """The API Management gateway SKUs operation response.
+
+ All required parameters must be populated in order to send to server.
+
+ :ivar value: The list of skus available for the gateway. Required.
+ :vartype value: list[~azure.mgmt.apimanagement.models.GatewayResourceSkuResult]
+ :ivar next_link: The uri to fetch the next page of API Management gateway Skus.
+ :vartype next_link: str
+ """
+
+ _validation = {
+ "value": {"required": True},
+ }
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[GatewayResourceSkuResult]"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self, *, value: List["_models.GatewayResourceSkuResult"], next_link: Optional[str] = None, **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: The list of skus available for the gateway. Required.
+ :paramtype value: list[~azure.mgmt.apimanagement.models.GatewayResourceSkuResult]
+ :keyword next_link: The uri to fetch the next page of API Management gateway Skus.
+ :paramtype next_link: str
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.next_link = next_link
+
+
+class GatewaySku(_serialization.Model):
+ """Describes an available API Management SKU for gateways.
+
+ :ivar name: Name of the Sku. Known values are: "Standard", "WorkspaceGatewayStandard", and
+ "WorkspaceGatewayPremium".
+ :vartype name: str or ~azure.mgmt.apimanagement.models.ApiGatewaySkuType
+ """
+
+ _attribute_map = {
+ "name": {"key": "name", "type": "str"},
+ }
+
+ def __init__(self, *, name: Optional[Union[str, "_models.ApiGatewaySkuType"]] = None, **kwargs: Any) -> None:
+ """
+ :keyword name: Name of the Sku. Known values are: "Standard", "WorkspaceGatewayStandard", and
+ "WorkspaceGatewayPremium".
+ :paramtype name: str or ~azure.mgmt.apimanagement.models.ApiGatewaySkuType
+ """
+ super().__init__(**kwargs)
+ self.name = name
+
+
+class GatewaySkuCapacity(_serialization.Model):
+ """Describes scaling information of a SKU.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar minimum: The minimum capacity.
+ :vartype minimum: int
+ :ivar maximum: The maximum capacity that can be set.
+ :vartype maximum: int
+ :ivar default: The default capacity.
+ :vartype default: int
+ :ivar scale_type: The scale type applicable to the sku. Known values are: "Automatic",
+ "Manual", and "None".
+ :vartype scale_type: str or ~azure.mgmt.apimanagement.models.GatewaySkuCapacityScaleType
+ """
+
+ _validation = {
+ "minimum": {"readonly": True},
+ "maximum": {"readonly": True},
+ "default": {"readonly": True},
+ "scale_type": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "minimum": {"key": "minimum", "type": "int"},
+ "maximum": {"key": "maximum", "type": "int"},
+ "default": {"key": "default", "type": "int"},
+ "scale_type": {"key": "scaleType", "type": "str"},
+ }
+
+ def __init__(self, **kwargs: Any) -> None:
+ """ """
+ super().__init__(**kwargs)
+ self.minimum = None
+ self.maximum = None
+ self.default = None
+ self.scale_type = None
+
+
class GatewayTokenContract(_serialization.Model):
"""Gateway access token.
@@ -10101,12 +11996,15 @@ class GlobalSchemaContract(ProxyResource):
:vartype value: any
:ivar document: Global Schema document object for json-based schema formats(e.g. json schema).
:vartype document: JSON
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -10117,6 +12015,7 @@ class GlobalSchemaContract(ProxyResource):
"description": {"key": "properties.description", "type": "str"},
"value": {"key": "properties.value", "type": "object"},
"document": {"key": "properties.document", "type": "object"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
}
def __init__(
@@ -10144,6 +12043,7 @@ def __init__(
self.description = description
self.value = value
self.document = document
+ self.provisioning_state = None
class GroupCollection(_serialization.Model):
@@ -10209,7 +12109,7 @@ class GroupContract(ProxyResource):
: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.
+ ``aad://.onmicrosoft.com/groups/``\\ ; otherwise the value is null.
:vartype external_id: str
"""
@@ -10252,7 +12152,7 @@ def __init__(
: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.
+ ``aad://.onmicrosoft.com/groups/``\\ ; otherwise the value is null.
:paramtype external_id: str
"""
super().__init__(**kwargs)
@@ -10281,7 +12181,7 @@ class GroupContractProperties(_serialization.Model):
: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.
+ ``aad://.onmicrosoft.com/groups/``\\ ; otherwise the value is null.
:vartype external_id: str
"""
@@ -10317,7 +12217,7 @@ def __init__(
: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.
+ ``aad://.onmicrosoft.com/groups/``\\ ; otherwise the value is null.
:paramtype external_id: str
"""
super().__init__(**kwargs)
@@ -10339,7 +12239,7 @@ class GroupCreateParameters(_serialization.Model):
: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.
+ ``aad://.onmicrosoft.com/groups/``\\ ; otherwise the value is null.
:vartype external_id: str
"""
@@ -10372,7 +12272,7 @@ def __init__(
: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.
+ ``aad://.onmicrosoft.com/groups/``\\ ; otherwise the value is null.
:paramtype external_id: str
"""
super().__init__(**kwargs)
@@ -10393,7 +12293,7 @@ class GroupUpdateParameters(_serialization.Model):
: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.
+ ``aad://.onmicrosoft.com/groups/``\\ ; otherwise the value is null.
:vartype external_id: str
"""
@@ -10426,7 +12326,7 @@ def __init__(
: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.
+ ``aad://.onmicrosoft.com/groups/``\\ ; otherwise the value is null.
:paramtype external_id: str
"""
super().__init__(**kwargs)
@@ -10442,7 +12342,7 @@ class HostnameConfiguration(_serialization.Model): # pylint: disable=too-many-i
All required parameters must be populated in order to send to server.
:ivar type: Hostname type. Required. Known values are: "Proxy", "Portal", "Management", "Scm",
- and "DeveloperPortal".
+ "DeveloperPortal", and "ConfigurationApi".
:vartype type: str or ~azure.mgmt.apimanagement.models.HostnameType
:ivar host_name: Hostname to configure on the Api Management service. Required.
:vartype host_name: str
@@ -10514,7 +12414,7 @@ def __init__(
) -> None:
"""
:keyword type: Hostname type. Required. Known values are: "Proxy", "Portal", "Management",
- "Scm", and "DeveloperPortal".
+ "Scm", "DeveloperPortal", and "ConfigurationApi".
:paramtype type: str or ~azure.mgmt.apimanagement.models.HostnameType
:keyword host_name: Hostname to configure on the Api Management service. Required.
:paramtype host_name: str
@@ -10777,6 +12677,8 @@ class IdentityProviderContract(ProxyResource): # pylint: disable=too-many-insta
Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations!
Use '/listSecrets' POST request to get the value.
:vartype client_secret: str
+ :ivar certificate_id: Certificate full resource ID used in external Identity Provider.
+ :vartype certificate_id: str
"""
_validation = {
@@ -10808,6 +12710,7 @@ class IdentityProviderContract(ProxyResource): # pylint: disable=too-many-insta
"client_library": {"key": "properties.clientLibrary", "type": "str"},
"client_id": {"key": "properties.clientId", "type": "str"},
"client_secret": {"key": "properties.clientSecret", "type": "str"},
+ "certificate_id": {"key": "properties.certificateId", "type": "str"},
}
def __init__(
@@ -10824,6 +12727,7 @@ def __init__(
client_library: Optional[str] = None,
client_id: Optional[str] = None,
client_secret: Optional[str] = None,
+ certificate_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""
@@ -10859,6 +12763,8 @@ def __init__(
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
+ :keyword certificate_id: Certificate full resource ID used in external Identity Provider.
+ :paramtype certificate_id: str
"""
super().__init__(**kwargs)
self.type_properties_type = type_properties_type
@@ -10872,6 +12778,7 @@ def __init__(
self.client_library = client_library
self.client_id = client_id
self.client_secret = client_secret
+ self.certificate_id = certificate_id
class IdentityProviderContractProperties(
@@ -10913,6 +12820,8 @@ class IdentityProviderContractProperties(
Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations!
Use '/listSecrets' POST request to get the value.
:vartype client_secret: str
+ :ivar certificate_id: Certificate full resource ID used in external Identity Provider.
+ :vartype certificate_id: str
"""
_validation = {
@@ -10938,6 +12847,7 @@ class IdentityProviderContractProperties(
"client_library": {"key": "clientLibrary", "type": "str"},
"client_id": {"key": "clientId", "type": "str"},
"client_secret": {"key": "clientSecret", "type": "str"},
+ "certificate_id": {"key": "certificateId", "type": "str"},
}
def __init__(
@@ -10954,6 +12864,7 @@ def __init__(
password_reset_policy_name: Optional[str] = None,
client_library: Optional[str] = None,
client_secret: Optional[str] = None,
+ certificate_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""
@@ -10989,6 +12900,8 @@ def __init__(
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
+ :keyword certificate_id: Certificate full resource ID used in external Identity Provider.
+ :paramtype certificate_id: str
"""
super().__init__(
type=type,
@@ -11004,6 +12917,7 @@ def __init__(
)
self.client_id = client_id
self.client_secret = client_secret
+ self.certificate_id = certificate_id
class IdentityProviderCreateContract(ProxyResource): # pylint: disable=too-many-instance-attributes
@@ -11049,6 +12963,8 @@ class IdentityProviderCreateContract(ProxyResource): # pylint: disable=too-many
Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations!
Use '/listSecrets' POST request to get the value.
:vartype client_secret: str
+ :ivar certificate_id: Certificate full resource ID used in external Identity Provider.
+ :vartype certificate_id: str
"""
_validation = {
@@ -11080,6 +12996,7 @@ class IdentityProviderCreateContract(ProxyResource): # pylint: disable=too-many
"client_library": {"key": "properties.clientLibrary", "type": "str"},
"client_id": {"key": "properties.clientId", "type": "str"},
"client_secret": {"key": "properties.clientSecret", "type": "str"},
+ "certificate_id": {"key": "properties.certificateId", "type": "str"},
}
def __init__(
@@ -11096,6 +13013,7 @@ def __init__(
client_library: Optional[str] = None,
client_id: Optional[str] = None,
client_secret: Optional[str] = None,
+ certificate_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""
@@ -11131,6 +13049,8 @@ def __init__(
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
+ :keyword certificate_id: Certificate full resource ID used in external Identity Provider.
+ :paramtype certificate_id: str
"""
super().__init__(**kwargs)
self.type_properties_type = type_properties_type
@@ -11144,6 +13064,7 @@ def __init__(
self.client_library = client_library
self.client_id = client_id
self.client_secret = client_secret
+ self.certificate_id = certificate_id
class IdentityProviderCreateContractProperties(
@@ -11185,6 +13106,8 @@ class IdentityProviderCreateContractProperties(
Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations!
Use '/listSecrets' POST request to get the value. Required.
:vartype client_secret: str
+ :ivar certificate_id: Certificate full resource ID used in external Identity Provider.
+ :vartype certificate_id: str
"""
_validation = {
@@ -11210,6 +13133,7 @@ class IdentityProviderCreateContractProperties(
"client_library": {"key": "clientLibrary", "type": "str"},
"client_id": {"key": "clientId", "type": "str"},
"client_secret": {"key": "clientSecret", "type": "str"},
+ "certificate_id": {"key": "certificateId", "type": "str"},
}
def __init__(
@@ -11226,6 +13150,7 @@ def __init__(
profile_editing_policy_name: Optional[str] = None,
password_reset_policy_name: Optional[str] = None,
client_library: Optional[str] = None,
+ certificate_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""
@@ -11261,6 +13186,8 @@ def __init__(
Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations!
Use '/listSecrets' POST request to get the value. Required.
:paramtype client_secret: str
+ :keyword certificate_id: Certificate full resource ID used in external Identity Provider.
+ :paramtype certificate_id: str
"""
super().__init__(
type=type,
@@ -11276,6 +13203,7 @@ def __init__(
)
self.client_id = client_id
self.client_secret = client_secret
+ self.certificate_id = certificate_id
class IdentityProviderList(_serialization.Model):
@@ -11349,6 +13277,8 @@ class IdentityProviderUpdateParameters(_serialization.Model): # pylint: disable
authenticate login request. For example, it is App Secret for Facebook login, API Key for
Google login, Public Key for Microsoft.
:vartype client_secret: str
+ :ivar certificate_id: Certificate full resource ID used in external Identity Provider.
+ :vartype certificate_id: str
"""
_validation = {
@@ -11374,6 +13304,7 @@ class IdentityProviderUpdateParameters(_serialization.Model): # pylint: disable
"client_library": {"key": "properties.clientLibrary", "type": "str"},
"client_id": {"key": "properties.clientId", "type": "str"},
"client_secret": {"key": "properties.clientSecret", "type": "str"},
+ "certificate_id": {"key": "properties.certificateId", "type": "str"},
}
def __init__(
@@ -11390,6 +13321,7 @@ def __init__(
client_library: Optional[str] = None,
client_id: Optional[str] = None,
client_secret: Optional[str] = None,
+ certificate_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""
@@ -11424,6 +13356,8 @@ def __init__(
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
+ :keyword certificate_id: Certificate full resource ID used in external Identity Provider.
+ :paramtype certificate_id: str
"""
super().__init__(**kwargs)
self.type = type
@@ -11437,6 +13371,7 @@ def __init__(
self.client_library = client_library
self.client_id = client_id
self.client_secret = client_secret
+ self.certificate_id = certificate_id
class IdentityProviderUpdateProperties(IdentityProviderBaseParameters): # pylint: disable=too-many-instance-attributes
@@ -11471,6 +13406,8 @@ class IdentityProviderUpdateProperties(IdentityProviderBaseParameters): # pylin
authenticate login request. For example, it is App Secret for Facebook login, API Key for
Google login, Public Key for Microsoft.
:vartype client_secret: str
+ :ivar certificate_id: Certificate full resource ID used in external Identity Provider.
+ :vartype certificate_id: str
"""
_validation = {
@@ -11496,6 +13433,7 @@ class IdentityProviderUpdateProperties(IdentityProviderBaseParameters): # pylin
"client_library": {"key": "clientLibrary", "type": "str"},
"client_id": {"key": "clientId", "type": "str"},
"client_secret": {"key": "clientSecret", "type": "str"},
+ "certificate_id": {"key": "certificateId", "type": "str"},
}
def __init__(
@@ -11512,6 +13450,7 @@ def __init__(
client_library: Optional[str] = None,
client_id: Optional[str] = None,
client_secret: Optional[str] = None,
+ certificate_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""
@@ -11546,6 +13485,8 @@ def __init__(
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
+ :keyword certificate_id: Certificate full resource ID used in external Identity Provider.
+ :paramtype certificate_id: str
"""
super().__init__(
type=type,
@@ -11561,6 +13502,7 @@ def __init__(
)
self.client_id = client_id
self.client_secret = client_secret
+ self.certificate_id = certificate_id
class IssueAttachmentCollection(_serialization.Model):
@@ -12196,24 +14138,103 @@ class KeyVaultLastAccessStatusContractProperties(_serialization.Model): # pylin
def __init__(
self,
*,
- code: Optional[str] = None,
- message: Optional[str] = None,
- time_stamp_utc: Optional[datetime.datetime] = None,
+ code: Optional[str] = None,
+ message: Optional[str] = None,
+ time_stamp_utc: Optional[datetime.datetime] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :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().__init__(**kwargs)
+ self.code = code
+ self.message = message
+ self.time_stamp_utc = time_stamp_utc
+
+
+class LLMDiagnosticSettings(_serialization.Model):
+ """Diagnostic settings for Large Language Models.
+
+ :ivar logs: Specifies whether default diagnostic should be enabled for Large Language Models or
+ not. Known values are: "enabled" and "disabled".
+ :vartype logs: str or ~azure.mgmt.apimanagement.models.LlmDiagnosticSettings
+ :ivar requests: Diagnostic settings for Large Language Models requests.
+ :vartype requests: ~azure.mgmt.apimanagement.models.LLMMessageDiagnosticSettings
+ :ivar responses: Diagnostic settings for Large Language Models responses.
+ :vartype responses: ~azure.mgmt.apimanagement.models.LLMMessageDiagnosticSettings
+ """
+
+ _attribute_map = {
+ "logs": {"key": "logs", "type": "str"},
+ "requests": {"key": "requests", "type": "LLMMessageDiagnosticSettings"},
+ "responses": {"key": "responses", "type": "LLMMessageDiagnosticSettings"},
+ }
+
+ def __init__(
+ self,
+ *,
+ logs: Optional[Union[str, "_models.LlmDiagnosticSettings"]] = None,
+ requests: Optional["_models.LLMMessageDiagnosticSettings"] = None,
+ responses: Optional["_models.LLMMessageDiagnosticSettings"] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword logs: Specifies whether default diagnostic should be enabled for Large Language Models
+ or not. Known values are: "enabled" and "disabled".
+ :paramtype logs: str or ~azure.mgmt.apimanagement.models.LlmDiagnosticSettings
+ :keyword requests: Diagnostic settings for Large Language Models requests.
+ :paramtype requests: ~azure.mgmt.apimanagement.models.LLMMessageDiagnosticSettings
+ :keyword responses: Diagnostic settings for Large Language Models responses.
+ :paramtype responses: ~azure.mgmt.apimanagement.models.LLMMessageDiagnosticSettings
+ """
+ super().__init__(**kwargs)
+ self.logs = logs
+ self.requests = requests
+ self.responses = responses
+
+
+class LLMMessageDiagnosticSettings(_serialization.Model):
+ """Diagnostic settings for Large Language Models Messages.
+
+ :ivar messages: Specifies which message should be logged. Currently there is only 'all' option.
+ "all"
+ :vartype messages: str or ~azure.mgmt.apimanagement.models.LlmMessageLogTypes
+ :ivar max_size_in_bytes: Maximum size of message to logs in bytes. The maximum size is 32KB.
+ :vartype max_size_in_bytes: int
+ """
+
+ _validation = {
+ "max_size_in_bytes": {"maximum": 262144, "minimum": 1},
+ }
+
+ _attribute_map = {
+ "messages": {"key": "messages", "type": "str"},
+ "max_size_in_bytes": {"key": "maxSizeInBytes", "type": "int"},
+ }
+
+ def __init__(
+ self,
+ *,
+ messages: Optional[Union[str, "_models.LlmMessageLogTypes"]] = None,
+ max_size_in_bytes: int = 32768,
**kwargs: Any
) -> None:
"""
- :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
+ :keyword messages: Specifies which message should be logged. Currently there is only 'all'
+ option. "all"
+ :paramtype messages: str or ~azure.mgmt.apimanagement.models.LlmMessageLogTypes
+ :keyword max_size_in_bytes: Maximum size of message to logs in bytes. The maximum size is 32KB.
+ :paramtype max_size_in_bytes: int
"""
super().__init__(**kwargs)
- self.code = code
- self.message = message
- self.time_stamp_utc = time_stamp_utc
+ self.messages = messages
+ self.max_size_in_bytes = max_size_in_bytes
class LoggerCollection(_serialization.Model):
@@ -12388,6 +14409,28 @@ def __init__(
self.is_buffered = is_buffered
+class MigrateToStv2Contract(_serialization.Model):
+ """Describes an available API Management SKU.
+
+ :ivar mode: Mode of Migration to stv2. Default is PreserveIp. Known values are: "PreserveIp"
+ and "NewIP".
+ :vartype mode: str or ~azure.mgmt.apimanagement.models.MigrateToStv2Mode
+ """
+
+ _attribute_map = {
+ "mode": {"key": "mode", "type": "str"},
+ }
+
+ def __init__(self, *, mode: Optional[Union[str, "_models.MigrateToStv2Mode"]] = None, **kwargs: Any) -> None:
+ """
+ :keyword mode: Mode of Migration to stv2. Default is PreserveIp. Known values are: "PreserveIp"
+ and "NewIP".
+ :paramtype mode: str or ~azure.mgmt.apimanagement.models.MigrateToStv2Mode
+ """
+ super().__init__(**kwargs)
+ self.mode = mode
+
+
class NamedValueCollection(_serialization.Model):
"""Paged NamedValue list representation.
@@ -12454,6 +14497,8 @@ class NamedValueContract(ProxyResource):
:vartype value: str
:ivar key_vault: KeyVault location details of the namedValue.
:vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
"""
_validation = {
@@ -12463,6 +14508,7 @@ class NamedValueContract(ProxyResource):
"tags": {"max_items": 32, "min_items": 0},
"display_name": {"max_length": 256, "min_length": 1, "pattern": r"^[A-Za-z0-9-._]+$"},
"value": {"max_length": 4096},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -12474,6 +14520,7 @@ class NamedValueContract(ProxyResource):
"display_name": {"key": "properties.displayName", "type": "str"},
"value": {"key": "properties.value", "type": "str"},
"key_vault": {"key": "properties.keyVault", "type": "KeyVaultContractProperties"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
}
def __init__(
@@ -12508,6 +14555,7 @@ def __init__(
self.display_name = display_name
self.value = value
self.key_vault = key_vault
+ self.provisioning_state = None
class NamedValueEntityBaseParameters(_serialization.Model):
@@ -12545,6 +14593,8 @@ def __init__(self, *, tags: Optional[List[str]] = None, secret: Optional[bool] =
class NamedValueContractProperties(NamedValueEntityBaseParameters):
"""NamedValue Contract 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 server.
:ivar tags: Optional tags that when provided can be used to filter the NamedValue list.
@@ -12561,12 +14611,15 @@ class NamedValueContractProperties(NamedValueEntityBaseParameters):
:vartype value: str
:ivar key_vault: KeyVault location details of the namedValue.
:vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
"""
_validation = {
"tags": {"max_items": 32, "min_items": 0},
"display_name": {"required": True, "max_length": 256, "min_length": 1, "pattern": r"^[A-Za-z0-9-._]+$"},
"value": {"max_length": 4096},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -12575,6 +14628,7 @@ class NamedValueContractProperties(NamedValueEntityBaseParameters):
"display_name": {"key": "displayName", "type": "str"},
"value": {"key": "value", "type": "str"},
"key_vault": {"key": "keyVault", "type": "KeyVaultContractProperties"},
+ "provisioning_state": {"key": "provisioningState", "type": "str"},
}
def __init__(
@@ -12607,6 +14661,7 @@ def __init__(
self.display_name = display_name
self.value = value
self.key_vault = key_vault
+ self.provisioning_state = None
class NamedValueCreateContract(ProxyResource):
@@ -13880,6 +15935,95 @@ def __init__(
self.object_key = object_key
+class OperationStatusResult(_serialization.Model):
+ """The current status of an async operation.
+
+ 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 server.
+
+ :ivar id: Fully qualified ID for the async operation.
+ :vartype id: str
+ :ivar resource_id: Fully qualified ID of the resource against which the original async
+ operation was started.
+ :vartype resource_id: str
+ :ivar name: Name of the async operation.
+ :vartype name: str
+ :ivar status: Operation status. Required.
+ :vartype status: str
+ :ivar percent_complete: Percent of the operation that is complete.
+ :vartype percent_complete: float
+ :ivar start_time: The start time of the operation.
+ :vartype start_time: ~datetime.datetime
+ :ivar end_time: The end time of the operation.
+ :vartype end_time: ~datetime.datetime
+ :ivar operations: The operations list.
+ :vartype operations: list[~azure.mgmt.apimanagement.models.OperationStatusResult]
+ :ivar error: If present, details of the operation error.
+ :vartype error: ~azure.mgmt.apimanagement.models.ErrorDetail
+ """
+
+ _validation = {
+ "resource_id": {"readonly": True},
+ "status": {"required": True},
+ "percent_complete": {"maximum": 100, "minimum": 0},
+ }
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ "resource_id": {"key": "resourceId", "type": "str"},
+ "name": {"key": "name", "type": "str"},
+ "status": {"key": "status", "type": "str"},
+ "percent_complete": {"key": "percentComplete", "type": "float"},
+ "start_time": {"key": "startTime", "type": "iso-8601"},
+ "end_time": {"key": "endTime", "type": "iso-8601"},
+ "operations": {"key": "operations", "type": "[OperationStatusResult]"},
+ "error": {"key": "error", "type": "ErrorDetail"},
+ }
+
+ def __init__(
+ self,
+ *,
+ status: str,
+ id: Optional[str] = None, # pylint: disable=redefined-builtin
+ name: Optional[str] = None,
+ percent_complete: Optional[float] = None,
+ start_time: Optional[datetime.datetime] = None,
+ end_time: Optional[datetime.datetime] = None,
+ operations: Optional[List["_models.OperationStatusResult"]] = None,
+ error: Optional["_models.ErrorDetail"] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword id: Fully qualified ID for the async operation.
+ :paramtype id: str
+ :keyword name: Name of the async operation.
+ :paramtype name: str
+ :keyword status: Operation status. Required.
+ :paramtype status: str
+ :keyword percent_complete: Percent of the operation that is complete.
+ :paramtype percent_complete: float
+ :keyword start_time: The start time of the operation.
+ :paramtype start_time: ~datetime.datetime
+ :keyword end_time: The end time of the operation.
+ :paramtype end_time: ~datetime.datetime
+ :keyword operations: The operations list.
+ :paramtype operations: list[~azure.mgmt.apimanagement.models.OperationStatusResult]
+ :keyword error: If present, details of the operation error.
+ :paramtype error: ~azure.mgmt.apimanagement.models.ErrorDetail
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.resource_id = None
+ self.name = name
+ self.status = status
+ self.percent_complete = percent_complete
+ self.start_time = start_time
+ self.end_time = end_time
+ self.operations = operations
+ self.error = error
+
+
class OperationTagResourceContractProperties(_serialization.Model):
"""Operation Entity contract Properties.
@@ -14543,12 +16687,227 @@ def __init__(
"""
super().__init__(**kwargs)
self.value = value
- self.count = count
+ self.count = count
+ self.next_link = next_link
+
+
+class PolicyFragmentContract(ProxyResource):
+ """Policy fragment 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}. # pylint: disable=line-too-long
+ :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 value: Contents of the policy fragment.
+ :vartype value: str
+ :ivar description: Policy fragment description.
+ :vartype description: str
+ :ivar format: Format of the policy fragment content. Known values are: "xml" and "rawxml".
+ :vartype format: str or ~azure.mgmt.apimanagement.models.PolicyFragmentContentFormat
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
+ """
+
+ _validation = {
+ "id": {"readonly": True},
+ "name": {"readonly": True},
+ "type": {"readonly": True},
+ "description": {"max_length": 1000},
+ "provisioning_state": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ "name": {"key": "name", "type": "str"},
+ "type": {"key": "type", "type": "str"},
+ "value": {"key": "properties.value", "type": "str"},
+ "description": {"key": "properties.description", "type": "str"},
+ "format": {"key": "properties.format", "type": "str"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: Optional[str] = None,
+ description: Optional[str] = None,
+ format: Optional[Union[str, "_models.PolicyFragmentContentFormat"]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: Contents of the policy fragment.
+ :paramtype value: str
+ :keyword description: Policy fragment description.
+ :paramtype description: str
+ :keyword format: Format of the policy fragment content. Known values are: "xml" and "rawxml".
+ :paramtype format: str or ~azure.mgmt.apimanagement.models.PolicyFragmentContentFormat
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.description = description
+ self.format = format
+ self.provisioning_state = None
+
+
+class PolicyRestrictionCollection(_serialization.Model):
+ """The response of the get policy restrictions operation.
+
+ :ivar value:
+ :vartype value: list[~azure.mgmt.apimanagement.models.PolicyRestrictionContract]
+ :ivar next_link: Next page link if any.
+ :vartype next_link: str
+ """
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[PolicyRestrictionContract]"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: Optional[List["_models.PolicyRestrictionContract"]] = None,
+ next_link: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value:
+ :paramtype value: list[~azure.mgmt.apimanagement.models.PolicyRestrictionContract]
+ :keyword next_link: Next page link if any.
+ :paramtype next_link: str
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.next_link = next_link
+
+
+class PolicyRestrictionContract(ProxyResource):
+ """Policy restriction 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}. # pylint: disable=line-too-long
+ :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 scope: Path to the policy document.
+ :vartype scope: str
+ :ivar require_base: Indicates if base policy should be enforced for the policy document. Known
+ values are: "true" and "false".
+ :vartype require_base: str or ~azure.mgmt.apimanagement.models.PolicyRestrictionRequireBase
+ """
+
+ _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"},
+ "scope": {"key": "properties.scope", "type": "str"},
+ "require_base": {"key": "properties.requireBase", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ scope: Optional[str] = None,
+ require_base: Union[str, "_models.PolicyRestrictionRequireBase"] = "false",
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword scope: Path to the policy document.
+ :paramtype scope: str
+ :keyword require_base: Indicates if base policy should be enforced for the policy document.
+ Known values are: "true" and "false".
+ :paramtype require_base: str or ~azure.mgmt.apimanagement.models.PolicyRestrictionRequireBase
+ """
+ super().__init__(**kwargs)
+ self.scope = scope
+ self.require_base = require_base
+
+
+class PolicyRestrictionUpdateContract(_serialization.Model):
+ """Policy restriction contract details.
+
+ :ivar scope: Path to the policy document.
+ :vartype scope: str
+ :ivar require_base: Indicates if base policy should be enforced for the policy document. Known
+ values are: "true" and "false".
+ :vartype require_base: str or ~azure.mgmt.apimanagement.models.PolicyRestrictionRequireBase
+ """
+
+ _attribute_map = {
+ "scope": {"key": "properties.scope", "type": "str"},
+ "require_base": {"key": "properties.requireBase", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ scope: Optional[str] = None,
+ require_base: Union[str, "_models.PolicyRestrictionRequireBase"] = "false",
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword scope: Path to the policy document.
+ :paramtype scope: str
+ :keyword require_base: Indicates if base policy should be enforced for the policy document.
+ Known values are: "true" and "false".
+ :paramtype require_base: str or ~azure.mgmt.apimanagement.models.PolicyRestrictionRequireBase
+ """
+ super().__init__(**kwargs)
+ self.scope = scope
+ self.require_base = require_base
+
+
+class PolicyWithComplianceCollection(_serialization.Model):
+ """The response of the list policy operation.
+
+ :ivar value: Policy Contract value.
+ :vartype value: list[~azure.mgmt.apimanagement.models.PolicyWithComplianceContract]
+ :ivar next_link: Next page link if any.
+ :vartype next_link: str
+ """
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[PolicyWithComplianceContract]"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: Optional[List["_models.PolicyWithComplianceContract"]] = None,
+ next_link: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: Policy Contract value.
+ :paramtype value: list[~azure.mgmt.apimanagement.models.PolicyWithComplianceContract]
+ :keyword next_link: Next page link if any.
+ :paramtype next_link: str
+ """
+ super().__init__(**kwargs)
+ self.value = value
self.next_link = next_link
-class PolicyFragmentContract(ProxyResource):
- """Policy fragment contract details.
+class PolicyWithComplianceContract(ProxyResource):
+ """Policy Contract details.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -14560,50 +16919,44 @@ class PolicyFragmentContract(ProxyResource):
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
- :ivar value: Contents of the policy fragment.
- :vartype value: str
- :ivar description: Policy fragment description.
- :vartype description: str
- :ivar format: Format of the policy fragment content. Known values are: "xml" and "rawxml".
- :vartype format: str or ~azure.mgmt.apimanagement.models.PolicyFragmentContentFormat
+ :ivar reference_policy_id: Policy Identifier.
+ :vartype reference_policy_id: str
+ :ivar compliance_state: Policy Restriction Compliance State. Known values are: "Pending",
+ "NonCompliant", and "Compliant".
+ :vartype compliance_state: str or ~azure.mgmt.apimanagement.models.PolicyComplianceState
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
- "description": {"max_length": 1000},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
- "value": {"key": "properties.value", "type": "str"},
- "description": {"key": "properties.description", "type": "str"},
- "format": {"key": "properties.format", "type": "str"},
+ "reference_policy_id": {"key": "properties.referencePolicyId", "type": "str"},
+ "compliance_state": {"key": "properties.complianceState", "type": "str"},
}
def __init__(
self,
*,
- value: Optional[str] = None,
- description: Optional[str] = None,
- format: Optional[Union[str, "_models.PolicyFragmentContentFormat"]] = None,
+ reference_policy_id: Optional[str] = None,
+ compliance_state: Optional[Union[str, "_models.PolicyComplianceState"]] = None,
**kwargs: Any
) -> None:
"""
- :keyword value: Contents of the policy fragment.
- :paramtype value: str
- :keyword description: Policy fragment description.
- :paramtype description: str
- :keyword format: Format of the policy fragment content. Known values are: "xml" and "rawxml".
- :paramtype format: str or ~azure.mgmt.apimanagement.models.PolicyFragmentContentFormat
+ :keyword reference_policy_id: Policy Identifier.
+ :paramtype reference_policy_id: str
+ :keyword compliance_state: Policy Restriction Compliance State. Known values are: "Pending",
+ "NonCompliant", and "Compliant".
+ :paramtype compliance_state: str or ~azure.mgmt.apimanagement.models.PolicyComplianceState
"""
super().__init__(**kwargs)
- self.value = value
- self.description = description
- self.format = format
+ self.reference_policy_id = reference_policy_id
+ self.compliance_state = compliance_state
class PortalConfigCollection(_serialization.Model):
@@ -14743,7 +17096,7 @@ class PortalConfigCspProperties(_serialization.Model):
:vartype mode: str or ~azure.mgmt.apimanagement.models.PortalSettingsCspMode
:ivar report_uri: The URLs used by the browser to report CSP violations.
:vartype report_uri: list[str]
- :ivar allowed_sources: Allowed sources, e.g. ``*.trusted.com``\ , ``trusted.com``\ ,
+ :ivar allowed_sources: Allowed sources, e.g. ``*.trusted.com``\\ , ``trusted.com``\\ ,
``https://``.
:vartype allowed_sources: list[str]
"""
@@ -14768,7 +17121,7 @@ def __init__(
:paramtype mode: str or ~azure.mgmt.apimanagement.models.PortalSettingsCspMode
:keyword report_uri: The URLs used by the browser to report CSP violations.
:paramtype report_uri: list[str]
- :keyword allowed_sources: Allowed sources, e.g. ``*.trusted.com``\ , ``trusted.com``\ ,
+ :keyword allowed_sources: Allowed sources, e.g. ``*.trusted.com``\\ , ``trusted.com``\\ ,
``https://``.
:paramtype allowed_sources: list[str]
"""
@@ -15021,6 +17374,8 @@ class PortalRevisionContract(ProxyResource):
:vartype created_date_time: ~datetime.datetime
:ivar updated_date_time: Last updated date and time.
:vartype updated_date_time: ~datetime.datetime
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
"""
_validation = {
@@ -15032,6 +17387,7 @@ class PortalRevisionContract(ProxyResource):
"status": {"readonly": True},
"created_date_time": {"readonly": True},
"updated_date_time": {"readonly": True},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -15044,6 +17400,7 @@ class PortalRevisionContract(ProxyResource):
"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"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
}
def __init__(self, *, description: Optional[str] = None, is_current: Optional[bool] = None, **kwargs: Any) -> None:
@@ -15060,6 +17417,7 @@ def __init__(self, *, description: Optional[str] = None, is_current: Optional[bo
self.is_current = is_current
self.created_date_time = None
self.updated_date_time = None
+ self.provisioning_state = None
class PortalSettingsCollection(_serialization.Model):
@@ -15577,6 +17935,84 @@ def __init__(
self.actions_required = actions_required
+class ProductApiLinkCollection(_serialization.Model):
+ """Paged Product-API link list representation.
+
+ :ivar value: Page values.
+ :vartype value: list[~azure.mgmt.apimanagement.models.ProductApiLinkContract]
+ :ivar count: Total record count number across all pages.
+ :vartype count: int
+ :ivar next_link: Next page link if any.
+ :vartype next_link: str
+ """
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[ProductApiLinkContract]"},
+ "count": {"key": "count", "type": "int"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: Optional[List["_models.ProductApiLinkContract"]] = None,
+ count: Optional[int] = None,
+ next_link: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: Page values.
+ :paramtype value: list[~azure.mgmt.apimanagement.models.ProductApiLinkContract]
+ :keyword count: Total record count number across all pages.
+ :paramtype count: int
+ :keyword next_link: Next page link if any.
+ :paramtype next_link: str
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.count = count
+ self.next_link = next_link
+
+
+class ProductApiLinkContract(ProxyResource):
+ """Product-API link 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}. # pylint: disable=line-too-long
+ :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 api_id: Full resource Id of an API.
+ :vartype api_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"},
+ "api_id": {"key": "properties.apiId", "type": "str"},
+ }
+
+ def __init__(self, *, api_id: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :keyword api_id: Full resource Id of an API.
+ :paramtype api_id: str
+ """
+ super().__init__(**kwargs)
+ self.api_id = api_id
+
+
class ProductCollection(_serialization.Model):
"""Paged Products list representation.
@@ -15928,6 +18364,84 @@ def __init__(
self.display_name = display_name
+class ProductGroupLinkCollection(_serialization.Model):
+ """Paged Product-group link list representation.
+
+ :ivar value: Page values.
+ :vartype value: list[~azure.mgmt.apimanagement.models.ProductGroupLinkContract]
+ :ivar count: Total record count number across all pages.
+ :vartype count: int
+ :ivar next_link: Next page link if any.
+ :vartype next_link: str
+ """
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[ProductGroupLinkContract]"},
+ "count": {"key": "count", "type": "int"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: Optional[List["_models.ProductGroupLinkContract"]] = None,
+ count: Optional[int] = None,
+ next_link: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: Page values.
+ :paramtype value: list[~azure.mgmt.apimanagement.models.ProductGroupLinkContract]
+ :keyword count: Total record count number across all pages.
+ :paramtype count: int
+ :keyword next_link: Next page link if any.
+ :paramtype next_link: str
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.count = count
+ self.next_link = next_link
+
+
+class ProductGroupLinkContract(ProxyResource):
+ """Product-group link 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}. # pylint: disable=line-too-long
+ :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 group_id: Full resource Id of a group.
+ :vartype group_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"},
+ "group_id": {"key": "properties.groupId", "type": "str"},
+ }
+
+ def __init__(self, *, group_id: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :keyword group_id: Full resource Id of a group.
+ :paramtype group_id: str
+ """
+ super().__init__(**kwargs)
+ self.group_id = group_id
+
+
class ProductTagResourceContractProperties(ProductEntityBaseParameters):
"""Product profile.
@@ -17732,7 +20246,7 @@ class ResourceSku(_serialization.Model):
"""Describes an available API Management SKU.
:ivar name: Name of the Sku. Known values are: "Developer", "Standard", "Premium", "Basic",
- "Consumption", and "Isolated".
+ "Consumption", "Isolated", "BasicV2", and "StandardV2".
:vartype name: str or ~azure.mgmt.apimanagement.models.SkuType
"""
@@ -17743,7 +20257,7 @@ class ResourceSku(_serialization.Model):
def __init__(self, *, name: Optional[Union[str, "_models.SkuType"]] = None, **kwargs: Any) -> None:
"""
:keyword name: Name of the Sku. Known values are: "Developer", "Standard", "Premium", "Basic",
- "Consumption", and "Isolated".
+ "Consumption", "Isolated", "BasicV2", and "StandardV2".
:paramtype name: str or ~azure.mgmt.apimanagement.models.SkuType
"""
super().__init__(**kwargs)
@@ -18026,8 +20540,11 @@ class SchemaContract(ProxyResource):
- ``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``.
+ ``application/vnd.ms-azure-apim.wadl.grammars+xml`` - ``OData Schema`` use
+ ``application/vnd.ms-azure-apim.odata.schema`` - ``gRPC Schema`` use ``text/protobuf``.
:vartype content_type: str
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
:ivar value: Json escaped string defining the document representing the Schema. Used for
schemas other than Swagger/OpenAPI.
:vartype value: str
@@ -18042,6 +20559,7 @@ class SchemaContract(ProxyResource):
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -18049,6 +20567,7 @@ class SchemaContract(ProxyResource):
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"content_type": {"key": "properties.contentType", "type": "str"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"value": {"key": "properties.document.value", "type": "str"},
"definitions": {"key": "properties.document.definitions", "type": "object"},
"components": {"key": "properties.document.components", "type": "object"},
@@ -18069,7 +20588,8 @@ def __init__(
- ``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``.
+ ``application/vnd.ms-azure-apim.wadl.grammars+xml`` - ``OData Schema`` use
+ ``application/vnd.ms-azure-apim.odata.schema`` - ``gRPC Schema`` use ``text/protobuf``.
:paramtype content_type: str
:keyword value: Json escaped string defining the document representing the Schema. Used for
schemas other than Swagger/OpenAPI.
@@ -18083,6 +20603,7 @@ def __init__(
"""
super().__init__(**kwargs)
self.content_type = content_type
+ self.provisioning_state = None
self.value = value
self.definitions = definitions
self.components = components
@@ -18604,40 +21125,118 @@ class SystemData(_serialization.Model):
"last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"},
}
- def __init__(
- self,
- *,
- created_by: Optional[str] = None,
- created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
- created_at: Optional[datetime.datetime] = None,
- last_modified_by: Optional[str] = None,
- last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
- last_modified_at: Optional[datetime.datetime] = None,
- **kwargs: Any
- ) -> None:
+ def __init__(
+ self,
+ *,
+ created_by: Optional[str] = None,
+ created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
+ created_at: Optional[datetime.datetime] = None,
+ last_modified_by: Optional[str] = None,
+ last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
+ last_modified_at: Optional[datetime.datetime] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :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. Known values are:
+ "User", "Application", "ManagedIdentity", and "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. Known
+ values are: "User", "Application", "ManagedIdentity", and "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().__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 TagApiLinkCollection(_serialization.Model):
+ """Paged Tag-API link list representation.
+
+ :ivar value: Page values.
+ :vartype value: list[~azure.mgmt.apimanagement.models.TagApiLinkContract]
+ :ivar count: Total record count number across all pages.
+ :vartype count: int
+ :ivar next_link: Next page link if any.
+ :vartype next_link: str
+ """
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[TagApiLinkContract]"},
+ "count": {"key": "count", "type": "int"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: Optional[List["_models.TagApiLinkContract"]] = None,
+ count: Optional[int] = None,
+ next_link: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: Page values.
+ :paramtype value: list[~azure.mgmt.apimanagement.models.TagApiLinkContract]
+ :keyword count: Total record count number across all pages.
+ :paramtype count: int
+ :keyword next_link: Next page link if any.
+ :paramtype next_link: str
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.count = count
+ self.next_link = next_link
+
+
+class TagApiLinkContract(ProxyResource):
+ """Tag-API link 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}. # pylint: disable=line-too-long
+ :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 api_id: Full resource Id of an API.
+ :vartype api_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"},
+ "api_id": {"key": "properties.apiId", "type": "str"},
+ }
+
+ def __init__(self, *, api_id: Optional[str] = None, **kwargs: Any) -> None:
"""
- :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. Known values are:
- "User", "Application", "ManagedIdentity", and "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. Known
- values are: "User", "Application", "ManagedIdentity", and "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
+ :keyword api_id: Full resource Id of an API.
+ :paramtype api_id: str
"""
super().__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
+ self.api_id = api_id
class TagCollection(_serialization.Model):
@@ -19002,6 +21601,162 @@ def __init__(
self.external_docs_description = external_docs_description
+class TagOperationLinkCollection(_serialization.Model):
+ """Paged Tag-operation link list representation.
+
+ :ivar value: Page values.
+ :vartype value: list[~azure.mgmt.apimanagement.models.TagOperationLinkContract]
+ :ivar count: Total record count number across all pages.
+ :vartype count: int
+ :ivar next_link: Next page link if any.
+ :vartype next_link: str
+ """
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[TagOperationLinkContract]"},
+ "count": {"key": "count", "type": "int"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: Optional[List["_models.TagOperationLinkContract"]] = None,
+ count: Optional[int] = None,
+ next_link: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: Page values.
+ :paramtype value: list[~azure.mgmt.apimanagement.models.TagOperationLinkContract]
+ :keyword count: Total record count number across all pages.
+ :paramtype count: int
+ :keyword next_link: Next page link if any.
+ :paramtype next_link: str
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.count = count
+ self.next_link = next_link
+
+
+class TagOperationLinkContract(ProxyResource):
+ """Tag-operation link 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}. # pylint: disable=line-too-long
+ :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 operation_id: Full resource Id of an API operation.
+ :vartype 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"},
+ "operation_id": {"key": "properties.operationId", "type": "str"},
+ }
+
+ def __init__(self, *, operation_id: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :keyword operation_id: Full resource Id of an API operation.
+ :paramtype operation_id: str
+ """
+ super().__init__(**kwargs)
+ self.operation_id = operation_id
+
+
+class TagProductLinkCollection(_serialization.Model):
+ """Paged Tag-product link list representation.
+
+ :ivar value: Page values.
+ :vartype value: list[~azure.mgmt.apimanagement.models.TagProductLinkContract]
+ :ivar count: Total record count number across all pages.
+ :vartype count: int
+ :ivar next_link: Next page link if any.
+ :vartype next_link: str
+ """
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[TagProductLinkContract]"},
+ "count": {"key": "count", "type": "int"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: Optional[List["_models.TagProductLinkContract"]] = None,
+ count: Optional[int] = None,
+ next_link: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: Page values.
+ :paramtype value: list[~azure.mgmt.apimanagement.models.TagProductLinkContract]
+ :keyword count: Total record count number across all pages.
+ :paramtype count: int
+ :keyword next_link: Next page link if any.
+ :paramtype next_link: str
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.count = count
+ self.next_link = next_link
+
+
+class TagProductLinkContract(ProxyResource):
+ """Tag-product link 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}. # pylint: disable=line-too-long
+ :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 product_id: Full resource Id of a product.
+ :vartype product_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"},
+ "product_id": {"key": "properties.productId", "type": "str"},
+ }
+
+ def __init__(self, *, product_id: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :keyword product_id: Full resource Id of a product.
+ :paramtype product_id: str
+ """
+ super().__init__(**kwargs)
+ self.product_id = product_id
+
+
class TagResourceCollection(_serialization.Model):
"""Paged Tag list representation.
@@ -20274,6 +23029,110 @@ def __init__(self, *, documents: Optional[List["_models.WikiDocumentationContrac
self.documents = documents
+class WorkspaceCollection(_serialization.Model):
+ """Paged workspace list representation.
+
+ :ivar value: Page values.
+ :vartype value: list[~azure.mgmt.apimanagement.models.WorkspaceContract]
+ :ivar count: Total record count number across all pages.
+ :vartype count: int
+ :ivar next_link: Next page link if any.
+ :vartype next_link: str
+ """
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[WorkspaceContract]"},
+ "count": {"key": "count", "type": "int"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: Optional[List["_models.WorkspaceContract"]] = None,
+ count: Optional[int] = None,
+ next_link: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: Page values.
+ :paramtype value: list[~azure.mgmt.apimanagement.models.WorkspaceContract]
+ :keyword count: Total record count number across all pages.
+ :paramtype count: int
+ :keyword next_link: Next page link if any.
+ :paramtype next_link: str
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.count = count
+ self.next_link = next_link
+
+
+class WorkspaceContract(ProxyResource):
+ """Workspace 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}. # pylint: disable=line-too-long
+ :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 display_name: Name of the workspace.
+ :vartype display_name: str
+ :ivar description: Description of the workspace.
+ :vartype description: 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"},
+ "display_name": {"key": "properties.displayName", "type": "str"},
+ "description": {"key": "properties.description", "type": "str"},
+ }
+
+ def __init__(self, *, display_name: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :keyword display_name: Name of the workspace.
+ :paramtype display_name: str
+ :keyword description: Description of the workspace.
+ :paramtype description: str
+ """
+ super().__init__(**kwargs)
+ self.display_name = display_name
+ self.description = description
+
+
+class WorkspaceLinksGateway(_serialization.Model):
+ """WorkspaceLinksGateway.
+
+ :ivar id: The link to the API Management gateway.
+ :vartype id: str
+ """
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ }
+
+ def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin
+ """
+ :keyword id: The link to the API Management gateway.
+ :paramtype id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
class X509CertificateName(_serialization.Model):
"""Properties of server X509Names.
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 b22d1486cf46..97018e014ea7 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
@@ -6,6 +6,9 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from ._api_gateway_operations import ApiGatewayOperations
+from ._api_management_gateway_skus_operations import ApiManagementGatewaySkusOperations
+from ._all_policies_operations import AllPoliciesOperations
from ._api_operations import ApiOperations
from ._api_revision_operations import ApiRevisionOperations
from ._api_release_operations import ApiReleaseOperations
@@ -27,11 +30,11 @@
from ._api_wikis_operations import ApiWikisOperations
from ._api_export_operations import ApiExportOperations
from ._api_version_set_operations import ApiVersionSetOperations
-from ._authorization_server_operations import AuthorizationServerOperations
from ._authorization_provider_operations import AuthorizationProviderOperations
from ._authorization_operations import AuthorizationOperations
from ._authorization_login_links_operations import AuthorizationLoginLinksOperations
from ._authorization_access_policy_operations import AuthorizationAccessPolicyOperations
+from ._authorization_server_operations import AuthorizationServerOperations
from ._backend_operations import BackendOperations
from ._cache_operations import CacheOperations
from ._certificate_operations import CertificateOperations
@@ -43,7 +46,9 @@
from ._api_management_service_skus_operations import ApiManagementServiceSkusOperations
from ._api_management_service_operations import ApiManagementServiceOperations
from ._diagnostic_operations import DiagnosticOperations
+from ._documentation_operations import DocumentationOperations
from ._email_template_operations import EmailTemplateOperations
+from ._api_gateway_config_connection_operations import ApiGatewayConfigConnectionOperations
from ._gateway_operations import GatewayOperations
from ._gateway_hostname_configuration_operations import GatewayHostnameConfigurationOperations
from ._gateway_api_operations import GatewayApiOperations
@@ -63,6 +68,8 @@
from ._policy_operations import PolicyOperations
from ._policy_description_operations import PolicyDescriptionOperations
from ._policy_fragment_operations import PolicyFragmentOperations
+from ._policy_restriction_operations import PolicyRestrictionOperations
+from ._policy_restriction_validations_operations import PolicyRestrictionValidationsOperations
from ._portal_config_operations import PortalConfigOperations
from ._portal_revision_operations import PortalRevisionOperations
from ._portal_settings_operations import PortalSettingsOperations
@@ -77,6 +84,8 @@
from ._product_policy_operations import ProductPolicyOperations
from ._product_wiki_operations import ProductWikiOperations
from ._product_wikis_operations import ProductWikisOperations
+from ._product_api_link_operations import ProductApiLinkOperations
+from ._product_group_link_operations import ProductGroupLinkOperations
from ._quota_by_counter_keys_operations import QuotaByCounterKeysOperations
from ._quota_by_period_keys_operations import QuotaByPeriodKeysOperations
from ._region_operations import RegionOperations
@@ -86,6 +95,9 @@
from ._api_management_skus_operations import ApiManagementSkusOperations
from ._subscription_operations import SubscriptionOperations
from ._tag_resource_operations import TagResourceOperations
+from ._tag_api_link_operations import TagApiLinkOperations
+from ._tag_operation_link_operations import TagOperationLinkOperations
+from ._tag_product_link_operations import TagProductLinkOperations
from ._tenant_access_operations import TenantAccessOperations
from ._tenant_access_git_operations import TenantAccessGitOperations
from ._tenant_configuration_operations import TenantConfigurationOperations
@@ -94,13 +106,52 @@
from ._user_subscription_operations import UserSubscriptionOperations
from ._user_identities_operations import UserIdentitiesOperations
from ._user_confirmation_password_operations import UserConfirmationPasswordOperations
-from ._documentation_operations import DocumentationOperations
+from ._workspace_backend_operations import WorkspaceBackendOperations
+from ._workspace_certificate_operations import WorkspaceCertificateOperations
+from ._workspace_diagnostic_operations import WorkspaceDiagnosticOperations
+from ._workspace_api_diagnostic_operations import WorkspaceApiDiagnosticOperations
+from ._api_management_workspace_links_operations import ApiManagementWorkspaceLinksOperations
+from ._api_management_workspace_link_operations import ApiManagementWorkspaceLinkOperations
+from ._workspace_logger_operations import WorkspaceLoggerOperations
+from ._workspace_operations import WorkspaceOperations
+from ._workspace_policy_operations import WorkspacePolicyOperations
+from ._workspace_named_value_operations import WorkspaceNamedValueOperations
+from ._workspace_global_schema_operations import WorkspaceGlobalSchemaOperations
+from ._workspace_notification_operations import WorkspaceNotificationOperations
+from ._workspace_notification_recipient_user_operations import WorkspaceNotificationRecipientUserOperations
+from ._workspace_notification_recipient_email_operations import WorkspaceNotificationRecipientEmailOperations
+from ._workspace_policy_fragment_operations import WorkspacePolicyFragmentOperations
+from ._workspace_group_operations import WorkspaceGroupOperations
+from ._workspace_group_user_operations import WorkspaceGroupUserOperations
+from ._workspace_subscription_operations import WorkspaceSubscriptionOperations
+from ._workspace_api_version_set_operations import WorkspaceApiVersionSetOperations
+from ._workspace_api_operations import WorkspaceApiOperations
+from ._workspace_api_revision_operations import WorkspaceApiRevisionOperations
+from ._workspace_api_release_operations import WorkspaceApiReleaseOperations
+from ._workspace_api_operation_operations import WorkspaceApiOperationOperations
+from ._workspace_api_operation_policy_operations import WorkspaceApiOperationPolicyOperations
+from ._workspace_api_policy_operations import WorkspaceApiPolicyOperations
+from ._workspace_api_schema_operations import WorkspaceApiSchemaOperations
+from ._workspace_product_operations import WorkspaceProductOperations
+from ._workspace_product_api_link_operations import WorkspaceProductApiLinkOperations
+from ._workspace_product_group_link_operations import WorkspaceProductGroupLinkOperations
+from ._workspace_product_policy_operations import WorkspaceProductPolicyOperations
+from ._workspace_tag_operations import WorkspaceTagOperations
+from ._workspace_tag_api_link_operations import WorkspaceTagApiLinkOperations
+from ._workspace_tag_operation_link_operations import WorkspaceTagOperationLinkOperations
+from ._workspace_tag_product_link_operations import WorkspaceTagProductLinkOperations
+from ._workspace_api_export_operations import WorkspaceApiExportOperations
+from ._operation_status_operations import OperationStatusOperations
+from ._operations_results_operations import OperationsResultsOperations
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
+ "ApiGatewayOperations",
+ "ApiManagementGatewaySkusOperations",
+ "AllPoliciesOperations",
"ApiOperations",
"ApiRevisionOperations",
"ApiReleaseOperations",
@@ -122,11 +173,11 @@
"ApiWikisOperations",
"ApiExportOperations",
"ApiVersionSetOperations",
- "AuthorizationServerOperations",
"AuthorizationProviderOperations",
"AuthorizationOperations",
"AuthorizationLoginLinksOperations",
"AuthorizationAccessPolicyOperations",
+ "AuthorizationServerOperations",
"BackendOperations",
"CacheOperations",
"CertificateOperations",
@@ -138,7 +189,9 @@
"ApiManagementServiceSkusOperations",
"ApiManagementServiceOperations",
"DiagnosticOperations",
+ "DocumentationOperations",
"EmailTemplateOperations",
+ "ApiGatewayConfigConnectionOperations",
"GatewayOperations",
"GatewayHostnameConfigurationOperations",
"GatewayApiOperations",
@@ -158,6 +211,8 @@
"PolicyOperations",
"PolicyDescriptionOperations",
"PolicyFragmentOperations",
+ "PolicyRestrictionOperations",
+ "PolicyRestrictionValidationsOperations",
"PortalConfigOperations",
"PortalRevisionOperations",
"PortalSettingsOperations",
@@ -172,6 +227,8 @@
"ProductPolicyOperations",
"ProductWikiOperations",
"ProductWikisOperations",
+ "ProductApiLinkOperations",
+ "ProductGroupLinkOperations",
"QuotaByCounterKeysOperations",
"QuotaByPeriodKeysOperations",
"RegionOperations",
@@ -181,6 +238,9 @@
"ApiManagementSkusOperations",
"SubscriptionOperations",
"TagResourceOperations",
+ "TagApiLinkOperations",
+ "TagOperationLinkOperations",
+ "TagProductLinkOperations",
"TenantAccessOperations",
"TenantAccessGitOperations",
"TenantConfigurationOperations",
@@ -189,7 +249,43 @@
"UserSubscriptionOperations",
"UserIdentitiesOperations",
"UserConfirmationPasswordOperations",
- "DocumentationOperations",
+ "WorkspaceBackendOperations",
+ "WorkspaceCertificateOperations",
+ "WorkspaceDiagnosticOperations",
+ "WorkspaceApiDiagnosticOperations",
+ "ApiManagementWorkspaceLinksOperations",
+ "ApiManagementWorkspaceLinkOperations",
+ "WorkspaceLoggerOperations",
+ "WorkspaceOperations",
+ "WorkspacePolicyOperations",
+ "WorkspaceNamedValueOperations",
+ "WorkspaceGlobalSchemaOperations",
+ "WorkspaceNotificationOperations",
+ "WorkspaceNotificationRecipientUserOperations",
+ "WorkspaceNotificationRecipientEmailOperations",
+ "WorkspacePolicyFragmentOperations",
+ "WorkspaceGroupOperations",
+ "WorkspaceGroupUserOperations",
+ "WorkspaceSubscriptionOperations",
+ "WorkspaceApiVersionSetOperations",
+ "WorkspaceApiOperations",
+ "WorkspaceApiRevisionOperations",
+ "WorkspaceApiReleaseOperations",
+ "WorkspaceApiOperationOperations",
+ "WorkspaceApiOperationPolicyOperations",
+ "WorkspaceApiPolicyOperations",
+ "WorkspaceApiSchemaOperations",
+ "WorkspaceProductOperations",
+ "WorkspaceProductApiLinkOperations",
+ "WorkspaceProductGroupLinkOperations",
+ "WorkspaceProductPolicyOperations",
+ "WorkspaceTagOperations",
+ "WorkspaceTagApiLinkOperations",
+ "WorkspaceTagOperationLinkOperations",
+ "WorkspaceTagProductLinkOperations",
+ "WorkspaceApiExportOperations",
+ "OperationStatusOperations",
+ "OperationsResultsOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_all_policies_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_all_policies_operations.py
new file mode 100644
index 000000000000..8321c7c066bc
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_all_policies_operations.py
@@ -0,0 +1,183 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/allPolicies",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class AllPoliciesOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`all_policies` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> Iterable["_models.AllPoliciesContract"]:
+ """Status of all policies of API Management services.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :return: An iterator like instance of either AllPoliciesContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.AllPoliciesContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.AllPoliciesCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("AllPoliciesCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
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 ecbaf566bebc..8d09a9d33db1 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +54,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,7 +75,7 @@ def build_list_by_service_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -98,7 +101,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -122,7 +125,7 @@ def build_get_entity_tag_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -142,7 +145,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -166,7 +169,7 @@ def build_get_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -193,7 +196,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -218,7 +221,7 @@ def build_create_or_update_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -249,7 +252,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -274,7 +277,7 @@ def build_update_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -304,7 +307,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -328,7 +331,7 @@ def build_delete_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -402,7 +405,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DiagnosticCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -425,7 +428,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -441,7 +443,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -492,7 +493,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -516,7 +517,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -559,7 +559,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -583,7 +583,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -601,7 +600,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DiagnosticContract", pipeline_response)
+ deserialized = self._deserialize("DiagnosticContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -720,7 +719,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -757,7 +756,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -773,15 +771,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DiagnosticContract", pipeline_response)
+ deserialized = self._deserialize("DiagnosticContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -900,7 +892,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -937,7 +929,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -955,7 +946,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DiagnosticContract", pipeline_response)
+ deserialized = self._deserialize("DiagnosticContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -986,7 +977,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1011,7 +1002,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 16262ba68e82..d1202bb1daeb 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar, Union
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,16 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -47,7 +50,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -68,7 +71,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -125,8 +128,8 @@ def get(
instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required.
:type api_id: str
:param format: Format in which to export the Api Details to the Storage Blob with Sas Key valid
- for 5 minutes. Known values are: "swagger-link", "wsdl-link", "wadl-link", "openapi-link", and
- "openapi+json-link". Required.
+ for 5 minutes. New formats can be added in the future. Known values are: "swagger-link",
+ "wsdl-link", "wadl-link", "openapi-link", and "openapi+json-link". Required.
:type format: str or ~azure.mgmt.apimanagement.models.ExportFormat
:param export: Query parameter required to export the API details. "true" Required.
:type export: str or ~azure.mgmt.apimanagement.models.ExportApi
@@ -134,7 +137,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.ApiExportResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -159,7 +162,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -174,7 +176,7 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiExportResult", pipeline_response)
+ deserialized = self._deserialize("ApiExportResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_gateway_config_connection_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_gateway_config_connection_operations.py
new file mode 100644
index 000000000000..67e2bcda4b0e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_gateway_config_connection_operations.py
@@ -0,0 +1,750 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.arm_polling import ARMPolling
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_gateway_request(
+ resource_group_name: str, gateway_name: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/gateways/{gatewayName}/configConnections",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "gatewayName": _SERIALIZER.url(
+ "gateway_name",
+ gateway_name,
+ "str",
+ max_length=45,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, gateway_name: str, config_connection_name: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/gateways/{gatewayName}/configConnections/{configConnectionName}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "gatewayName": _SERIALIZER.url(
+ "gateway_name",
+ gateway_name,
+ "str",
+ max_length=45,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "configConnectionName": _SERIALIZER.url(
+ "config_connection_name",
+ config_connection_name,
+ "str",
+ max_length=30,
+ 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str, gateway_name: str, config_connection_name: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/gateways/{gatewayName}/configConnections/{configConnectionName}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "gatewayName": _SERIALIZER.url(
+ "gateway_name",
+ gateway_name,
+ "str",
+ max_length=45,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "configConnectionName": _SERIALIZER.url(
+ "config_connection_name",
+ config_connection_name,
+ "str",
+ max_length=30,
+ 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ gateway_name: str,
+ config_connection_name: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/gateways/{gatewayName}/configConnections/{configConnectionName}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "gatewayName": _SERIALIZER.url(
+ "gateway_name",
+ gateway_name,
+ "str",
+ max_length=45,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "configConnectionName": _SERIALIZER.url(
+ "config_connection_name",
+ config_connection_name,
+ "str",
+ max_length=30,
+ 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class ApiGatewayConfigConnectionOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`api_gateway_config_connection` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_gateway(
+ self, resource_group_name: str, gateway_name: str, **kwargs: Any
+ ) -> Iterable["_models.ApiManagementGatewayConfigConnectionResource"]:
+ """List all API Management gateway config connections within a gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :return: An iterator like instance of either ApiManagementGatewayConfigConnectionResource or
+ the result of cls(response)
+ :rtype:
+ ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementGatewayConfigConnectionListResult] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_gateway_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiManagementGatewayConfigConnectionListResult", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, gateway_name: str, config_connection_name: str, **kwargs: Any
+ ) -> _models.ApiManagementGatewayConfigConnectionResource:
+ """Gets an API Management gateway config connection resource description.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param config_connection_name: The name of the API Management gateway config connection.
+ Required.
+ :type config_connection_name: str
+ :return: ApiManagementGatewayConfigConnectionResource or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementGatewayConfigConnectionResource] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ config_connection_name=config_connection_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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(
+ "ApiManagementGatewayConfigConnectionResource", pipeline_response.http_response
+ )
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ config_connection_name: str,
+ parameters: Union[_models.ApiManagementGatewayConfigConnectionResource, IO[bytes]],
+ **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiManagementGatewayConfigConnectionResource")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ config_connection_name=config_connection_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ config_connection_name: str,
+ parameters: _models.ApiManagementGatewayConfigConnectionResource,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiManagementGatewayConfigConnectionResource]:
+ """Creates or updates an API Management gateway config connection. This is long running operation
+ and could take several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param config_connection_name: The name of the API Management gateway config connection.
+ Required.
+ :type config_connection_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway config
+ connection operation. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of LROPoller that returns either
+ ApiManagementGatewayConfigConnectionResource or the result of cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ config_connection_name: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiManagementGatewayConfigConnectionResource]:
+ """Creates or updates an API Management gateway config connection. This is long running operation
+ and could take several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param config_connection_name: The name of the API Management gateway config connection.
+ Required.
+ :type config_connection_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway config
+ connection operation. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of LROPoller that returns either
+ ApiManagementGatewayConfigConnectionResource or the result of cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ config_connection_name: str,
+ parameters: Union[_models.ApiManagementGatewayConfigConnectionResource, IO[bytes]],
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiManagementGatewayConfigConnectionResource]:
+ """Creates or updates an API Management gateway config connection. This is long running operation
+ and could take several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param config_connection_name: The name of the API Management gateway config connection.
+ Required.
+ :type config_connection_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway config
+ connection operation. Is either a ApiManagementGatewayConfigConnectionResource type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource
+ or IO[bytes]
+ :return: An instance of LROPoller that returns either
+ ApiManagementGatewayConfigConnectionResource or the result of cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayConfigConnectionResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiManagementGatewayConfigConnectionResource] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ config_connection_name=config_connection_name,
+ parameters=parameters,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ deserialized = self._deserialize(
+ "ApiManagementGatewayConfigConnectionResource", pipeline_response.http_response
+ )
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: PollingMethod = cast(
+ PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[_models.ApiManagementGatewayConfigConnectionResource].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[_models.ApiManagementGatewayConfigConnectionResource](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ def _delete_initial(
+ self, resource_group_name: str, gateway_name: str, config_connection_name: str, if_match: str, **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ config_connection_name=config_connection_name,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def begin_delete(
+ self, resource_group_name: str, gateway_name: str, config_connection_name: str, if_match: str, **kwargs: Any
+ ) -> LROPoller[None]:
+ """Deletes an existing API Management gateway config connection.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param config_connection_name: The name of the API Management gateway config connection.
+ Required.
+ :type config_connection_name: 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. Required.
+ :type if_match: str
+ :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:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._delete_initial(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ config_connection_name=config_connection_name,
+ if_match=if_match,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+
+ if polling is True:
+ polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[None].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_gateway_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_gateway_operations.py
new file mode 100644
index 000000000000..5b22ee4da6cf
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_gateway_operations.py
@@ -0,0 +1,1020 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.arm_polling import ARMPolling
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_create_or_update_request(
+ resource_group_name: str, gateway_name: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/gateways/{gatewayName}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "gatewayName": _SERIALIZER.url(
+ "gateway_name",
+ gateway_name,
+ "str",
+ max_length=45,
+ 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str, gateway_name: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/gateways/{gatewayName}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "gatewayName": _SERIALIZER.url(
+ "gateway_name",
+ gateway_name,
+ "str",
+ max_length=45,
+ 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(resource_group_name: str, gateway_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/gateways/{gatewayName}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "gatewayName": _SERIALIZER.url(
+ "gateway_name",
+ gateway_name,
+ "str",
+ max_length=45,
+ 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str, gateway_name: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/gateways/{gatewayName}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "gatewayName": _SERIALIZER.url(
+ "gateway_name",
+ gateway_name,
+ "str",
+ max_length=45,
+ 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/gateways",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/gateways")
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class ApiGatewayOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`api_gateway` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: Union[_models.ApiManagementGatewayResource, IO[bytes]],
+ **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiManagementGatewayResource")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: _models.ApiManagementGatewayResource,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiManagementGatewayResource]:
+ """Creates or updates an API Management gateway. This is long running operation and could take
+ several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway operation.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementGatewayResource
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of LROPoller that returns either ApiManagementGatewayResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiManagementGatewayResource]:
+ """Creates or updates an API Management gateway. This is long running operation and could take
+ several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway operation.
+ Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of LROPoller that returns either ApiManagementGatewayResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: Union[_models.ApiManagementGatewayResource, IO[bytes]],
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiManagementGatewayResource]:
+ """Creates or updates an API Management gateway. This is long running operation and could take
+ several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway operation.
+ Is either a ApiManagementGatewayResource type or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementGatewayResource or IO[bytes]
+ :return: An instance of LROPoller that returns either ApiManagementGatewayResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiManagementGatewayResource] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ parameters=parameters,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ deserialized = self._deserialize("ApiManagementGatewayResource", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[_models.ApiManagementGatewayResource].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[_models.ApiManagementGatewayResource](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ def _update_initial(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: Union[_models.ApiManagementGatewayUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiManagementGatewayUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def begin_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: _models.ApiManagementGatewayUpdateParameters,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiManagementGatewayResource]:
+ """Updates an existing API Management gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway operation.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementGatewayUpdateParameters
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of LROPoller that returns either ApiManagementGatewayResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def begin_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiManagementGatewayResource]:
+ """Updates an existing API Management gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway operation.
+ Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of LROPoller that returns either ApiManagementGatewayResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def begin_update(
+ self,
+ resource_group_name: str,
+ gateway_name: str,
+ parameters: Union[_models.ApiManagementGatewayUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiManagementGatewayResource]:
+ """Updates an existing API Management gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :param parameters: Parameters supplied to the CreateOrUpdate API Management gateway operation.
+ Is either a ApiManagementGatewayUpdateParameters type or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementGatewayUpdateParameters or
+ IO[bytes]
+ :return: An instance of LROPoller that returns either ApiManagementGatewayResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiManagementGatewayResource] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._update_initial(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ parameters=parameters,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ deserialized = self._deserialize("ApiManagementGatewayResource", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[_models.ApiManagementGatewayResource].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[_models.ApiManagementGatewayResource](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ @distributed_trace
+ def get(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> _models.ApiManagementGatewayResource:
+ """Gets an API Management gateway resource description.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :return: ApiManagementGatewayResource or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiManagementGatewayResource
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementGatewayResource] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiManagementGatewayResource", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ def _delete_initial(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def begin_delete(
+ self, resource_group_name: str, gateway_name: str, **kwargs: Any
+ ) -> LROPoller[_models.ApiManagementGatewayResource]:
+ """Deletes an existing API Management gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :return: An instance of LROPoller that returns either ApiManagementGatewayResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementGatewayResource] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._delete_initial(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ response_headers = {}
+ response = pipeline_response.http_response
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = self._deserialize("ApiManagementGatewayResource", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[_models.ApiManagementGatewayResource].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[_models.ApiManagementGatewayResource](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ @distributed_trace
+ def list_by_resource_group(
+ self, resource_group_name: str, **kwargs: Any
+ ) -> Iterable["_models.ApiManagementGatewayResource"]:
+ """List all API Management gateways within a resource group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :return: An iterator like instance of either ApiManagementGatewayResource or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementGatewayListResult] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_resource_group_request(
+ resource_group_name=resource_group_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiManagementGatewayListResult", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def list(self, **kwargs: Any) -> Iterable["_models.ApiManagementGatewayResource"]:
+ """List all API Management gateways within a subscription.
+
+ :return: An iterator like instance of either ApiManagementGatewayResource or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiManagementGatewayResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementGatewayListResult] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_request(
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiManagementGatewayListResult", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
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 97bef2e9b2a2..cf0e8dd60c09 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -52,7 +55,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -76,7 +79,7 @@ def build_list_by_service_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -108,7 +111,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -135,7 +138,7 @@ def build_get_entity_tag_request(
"attachmentId": _SERIALIZER.url(
"attachment_id", attachment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -161,7 +164,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -188,7 +191,7 @@ def build_get_request(
"attachmentId": _SERIALIZER.url(
"attachment_id", attachment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -216,7 +219,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -244,7 +247,7 @@ def build_create_or_update_request(
"attachmentId": _SERIALIZER.url(
"attachment_id", attachment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -276,7 +279,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -303,7 +306,7 @@ def build_delete_request(
"attachmentId": _SERIALIZER.url(
"attachment_id", attachment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -383,7 +386,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.IssueAttachmentCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -407,7 +410,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -423,7 +425,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -478,7 +479,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -503,7 +504,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -549,7 +549,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.IssueAttachmentContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -574,7 +574,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -592,7 +591,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueAttachmentContract", pipeline_response)
+ deserialized = self._deserialize("IssueAttachmentContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -723,7 +722,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.IssueAttachmentContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -761,7 +760,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -777,15 +775,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueAttachmentContract", pipeline_response)
+ deserialized = self._deserialize("IssueAttachmentContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -826,7 +818,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -852,7 +844,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 b51496e88e4e..18b55b5dd487 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -52,7 +55,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -76,7 +79,7 @@ def build_list_by_service_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -108,7 +111,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -135,7 +138,7 @@ def build_get_entity_tag_request(
"commentId": _SERIALIZER.url(
"comment_id", comment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -161,7 +164,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -188,7 +191,7 @@ def build_get_request(
"commentId": _SERIALIZER.url(
"comment_id", comment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -216,7 +219,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -244,7 +247,7 @@ def build_create_or_update_request(
"commentId": _SERIALIZER.url(
"comment_id", comment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -276,7 +279,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -303,7 +306,7 @@ def build_delete_request(
"commentId": _SERIALIZER.url(
"comment_id", comment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -383,7 +386,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.IssueCommentCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -407,7 +410,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -423,7 +425,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -478,7 +479,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -503,7 +504,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -549,7 +549,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.IssueCommentContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -574,7 +574,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -592,7 +591,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueCommentContract", pipeline_response)
+ deserialized = self._deserialize("IssueCommentContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -723,7 +722,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.IssueCommentContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -761,7 +760,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -777,15 +775,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueCommentContract", pipeline_response)
+ deserialized = self._deserialize("IssueCommentContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -826,7 +818,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -852,7 +844,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 6a82c1c76e79..2294f80088e4 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -52,7 +55,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -73,7 +76,7 @@ def build_list_by_service_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -103,7 +106,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -127,7 +130,7 @@ def build_get_entity_tag_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -154,7 +157,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -178,7 +181,7 @@ def build_get_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -209,7 +212,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -234,7 +237,7 @@ def build_create_or_update_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -265,7 +268,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -290,7 +293,7 @@ def build_update_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -320,7 +323,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -344,7 +347,7 @@ def build_delete_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -422,7 +425,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.IssueCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -446,7 +449,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -462,7 +464,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -513,7 +514,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -537,7 +538,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -588,7 +588,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.IssueContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -613,7 +613,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -631,7 +630,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueContract", pipeline_response)
+ deserialized = self._deserialize("IssueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -750,7 +749,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.IssueContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -787,7 +786,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -803,15 +801,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueContract", pipeline_response)
+ deserialized = self._deserialize("IssueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -930,7 +922,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.IssueContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -967,7 +959,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -985,7 +976,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueContract", pipeline_response)
+ deserialized = self._deserialize("IssueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1016,7 +1007,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1041,7 +1032,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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
index d81a58ffebf8..4390c4f8cb42 100644
--- 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,12 +16,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -28,8 +30,12 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+from .._vendor import ApiManagementClientMixinABC
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +49,7 @@ def build_perform_connectivity_check_async_request( # pylint: disable=name-too-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -64,7 +70,7 @@ def build_perform_connectivity_check_async_request( # pylint: disable=name-too-
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -81,14 +87,15 @@ def build_perform_connectivity_check_async_request( # pylint: disable=name-too-
class ApiManagementClientOperationsMixin(ApiManagementClientMixinABC):
+
def _perform_connectivity_check_async_initial( # pylint: disable=name-too-long
self,
resource_group_name: str,
service_name: str,
connectivity_check_request_params: Union[_models.ConnectivityCheckRequest, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.ConnectivityCheckResponse]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -101,7 +108,7 @@ def _perform_connectivity_check_async_initial( # pylint: disable=name-too-long
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.ConnectivityCheckResponse]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -122,10 +129,10 @@ def _perform_connectivity_check_async_initial( # pylint: disable=name-too-long
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -133,16 +140,22 @@ def _perform_connectivity_check_async_initial( # pylint: disable=name-too-long
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
- if response.status_code == 200:
- deserialized = self._deserialize("ConnectivityCheckResponse", pipeline_response)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@@ -254,10 +267,11 @@ def begin_perform_connectivity_check_async(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ConnectivityCheckResponse", pipeline_response)
+ deserialized = self._deserialize("ConnectivityCheckResponse", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_gateway_skus_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_gateway_skus_operations.py
new file mode 100644
index 000000000000..1b92a9d6bc15
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_gateway_skus_operations.py
@@ -0,0 +1,186 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_available_skus_request(
+ resource_group_name: str, gateway_name: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/gateways/{gatewayName}/skus",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "gatewayName": _SERIALIZER.url(
+ "gateway_name",
+ gateway_name,
+ "str",
+ max_length=45,
+ 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class ApiManagementGatewaySkusOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`api_management_gateway_skus` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_available_skus(
+ self, resource_group_name: str, gateway_name: str, **kwargs: Any
+ ) -> Iterable["_models.GatewayResourceSkuResult"]:
+ """Gets available SKUs for API Management gateway.
+
+ Gets all available SKU for a given API Management gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param gateway_name: The name of the API Management gateway. Required.
+ :type gateway_name: str
+ :return: An iterator like instance of either GatewayResourceSkuResult or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.GatewayResourceSkuResult]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.GatewayResourceSkuResults] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_available_skus_request(
+ resource_group_name=resource_group_name,
+ gateway_name=gateway_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("GatewayResourceSkuResults", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
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 919ae35e4639..17be86c52335 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -88,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -104,7 +107,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -120,7 +122,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 6aefc4c75dbe..fca37e4bbe7e 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +50,7 @@ def build_restore_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -66,7 +71,7 @@ def build_restore_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -88,7 +93,7 @@ def build_backup_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -109,7 +114,7 @@ def build_backup_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -131,7 +136,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -152,7 +157,7 @@ def build_create_or_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -174,7 +179,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -195,7 +200,7 @@ def build_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -215,7 +220,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -235,7 +240,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -255,7 +260,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -275,7 +280,7 @@ def build_delete_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -295,7 +300,8 @@ def build_migrate_to_stv2_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -315,7 +321,7 @@ def build_migrate_to_stv2_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -324,6 +330,8 @@ def build_migrate_to_stv2_request(
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
@@ -333,7 +341,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -345,7 +353,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -363,13 +371,13 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -389,7 +397,7 @@ def build_get_sso_token_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -409,7 +417,7 @@ def build_get_sso_token_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -427,7 +435,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -436,7 +444,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability"
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -458,7 +466,7 @@ def build_get_domain_ownership_identifier_request( # pylint: disable=name-too-l
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -466,7 +474,7 @@ def build_get_domain_ownership_identifier_request( # pylint: disable=name-too-l
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier"
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -486,7 +494,7 @@ def build_apply_network_configuration_updates_request( # pylint: disable=name-t
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -507,7 +515,7 @@ def build_apply_network_configuration_updates_request( # pylint: disable=name-t
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -548,8 +556,8 @@ def _restore_initial(
service_name: str,
parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.ApiManagementServiceResource]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -562,7 +570,7 @@ def _restore_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -583,10 +591,10 @@ def _restore_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -594,18 +602,20 @@ def _restore_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
-
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -724,10 +734,11 @@ def begin_restore(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -757,8 +768,8 @@ def _backup_initial(
service_name: str,
parameters: Union[_models.ApiManagementServiceBackupRestoreParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.ApiManagementServiceResource]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -771,7 +782,7 @@ def _backup_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -792,10 +803,10 @@ def _backup_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -803,17 +814,19 @@ def _backup_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
-
if response.status_code == 202:
- response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -927,10 +940,11 @@ def begin_backup(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -960,8 +974,8 @@ def _create_or_update_initial(
service_name: str,
parameters: Union[_models.ApiManagementServiceResource, IO[bytes]],
**kwargs: Any
- ) -> _models.ApiManagementServiceResource:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -974,7 +988,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -995,10 +1009,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -1006,15 +1020,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 response.status_code == 200:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1129,10 +1143,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -1160,8 +1175,8 @@ def _update_initial(
service_name: str,
parameters: Union[_models.ApiManagementServiceUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.ApiManagementServiceResource]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1174,7 +1189,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -1195,10 +1210,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -1206,16 +1221,22 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
- if response.status_code == 200:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@@ -1325,10 +1346,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -1363,7 +1385,7 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo
:rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1385,7 +1407,6 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1400,17 +1421,15 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- def _delete_initial(
- self, resource_group_name: str, service_name: str, **kwargs: Any
- ) -> Optional[_models.ApiManagementServiceResource]:
- error_map = {
+ def _delete_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1422,7 +1441,7 @@ def _delete_initial(
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -1432,10 +1451,10 @@ def _delete_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -1443,16 +1462,22 @@ def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
+ response_headers = {}
if response.status_code == 202:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@@ -1491,12 +1516,17 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ response_headers = {}
+ response = pipeline_response.http_response
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
if polling is True:
@@ -1517,9 +1547,13 @@ def get_long_running_output(pipeline_response):
)
def _migrate_to_stv2_initial(
- self, resource_group_name: str, service_name: str, **kwargs: Any
- ) -> Optional[_models.ApiManagementServiceResource]:
- error_map = {
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[Union[_models.MigrateToStv2Contract, IO[bytes]]] = None,
+ **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1527,24 +1561,39 @@ def _migrate_to_stv2_initial(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None)
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ if parameters is not None:
+ _json = self._serialize.body(parameters, "MigrateToStv2Contract")
+ else:
+ _json = None
_request = build_migrate_to_stv2_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -1552,26 +1601,94 @@ def _migrate_to_stv2_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
-
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
+ @overload
+ def begin_migrate_to_stv2(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[_models.MigrateToStv2Contract] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiManagementServiceResource]:
+ """Upgrades an API Management service to the Stv2 platform. For details refer to
+ https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation
+ and could take several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param parameters: Optional parameters supplied to migrate service. Default value is None.
+ :type parameters: ~azure.mgmt.apimanagement.models.MigrateToStv2Contract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @overload
+ def begin_migrate_to_stv2(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiManagementServiceResource]:
+ """Upgrades an API Management service to the Stv2 platform. For details refer to
+ https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation
+ and could take several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param parameters: Optional parameters supplied to migrate service. Default value is None.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
@distributed_trace
def begin_migrate_to_stv2(
- self, resource_group_name: str, service_name: str, **kwargs: Any
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[Union[_models.MigrateToStv2Contract, IO[bytes]]] = None,
+ **kwargs: Any
) -> LROPoller[_models.ApiManagementServiceResource]:
"""Upgrades an API Management service to the Stv2 platform. For details refer to
https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation
@@ -1582,16 +1699,20 @@ def begin_migrate_to_stv2(
:type resource_group_name: str
:param service_name: The name of the API Management service. Required.
:type service_name: str
+ :param parameters: Optional parameters supplied to migrate service. Is either a
+ MigrateToStv2Contract type or a IO[bytes] type. Default value is None.
+ :type parameters: ~azure.mgmt.apimanagement.models.MigrateToStv2Contract or IO[bytes]
: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:
"""
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
@@ -1600,16 +1721,19 @@ def begin_migrate_to_stv2(
raw_result = self._migrate_to_stv2_initial(
resource_group_name=resource_group_name,
service_name=service_name,
+ parameters=parameters,
api_version=api_version,
+ content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -1654,7 +1778,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiManagementServiceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1672,7 +1796,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1688,7 +1811,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1734,7 +1856,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ApiManagementServiceResource"
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiManagementServiceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1751,7 +1873,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1767,7 +1888,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1812,7 +1932,7 @@ def get_sso_token(
:rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceGetSsoTokenResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1834,7 +1954,6 @@ def get_sso_token(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1849,7 +1968,7 @@ def get_sso_token(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiManagementServiceGetSsoTokenResult", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceGetSsoTokenResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1908,7 +2027,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1940,7 +2059,6 @@ def check_name_availability(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1955,7 +2073,7 @@ def check_name_availability(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiManagementServiceNameAvailabilityResult", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceNameAvailabilityResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1972,7 +2090,7 @@ def get_domain_ownership_identifier(
:rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceGetDomainOwnershipIdentifierResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1992,7 +2110,6 @@ def get_domain_ownership_identifier(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -2007,7 +2124,9 @@ def get_domain_ownership_identifier(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiManagementServiceGetDomainOwnershipIdentifierResult", pipeline_response)
+ deserialized = self._deserialize(
+ "ApiManagementServiceGetDomainOwnershipIdentifierResult", pipeline_response.http_response
+ )
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -2020,8 +2139,8 @@ def _apply_network_configuration_updates_initial( # pylint: disable=name-too-lo
service_name: str,
parameters: Optional[Union[_models.ApiManagementServiceApplyNetworkConfigurationParameters, IO[bytes]]] = None,
**kwargs: Any
- ) -> Optional[_models.ApiManagementServiceResource]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2034,7 +2153,7 @@ def _apply_network_configuration_updates_initial( # pylint: disable=name-too-lo
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -2058,10 +2177,10 @@ def _apply_network_configuration_updates_initial( # pylint: disable=name-too-lo
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -2069,18 +2188,20 @@ def _apply_network_configuration_updates_initial( # pylint: disable=name-too-lo
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
-
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -2202,10 +2323,11 @@ def begin_apply_network_configuration_updates( # pylint: disable=name-too-long
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response)
+ deserialized = self._deserialize("ApiManagementServiceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
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 7f078f145606..d9aaa395865e 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -42,7 +45,7 @@ def build_list_available_service_skus_request( # pylint: disable=name-too-long
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,7 +65,7 @@ def build_list_available_service_skus_request( # pylint: disable=name-too-long
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -118,7 +121,7 @@ def list_available_service_skus(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ResourceSkuResults] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -137,7 +140,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -153,7 +155,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 7135f407127f..4dc754d550d9 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,13 +43,13 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -93,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ApiManagementSku"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiManagementSkusResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -110,7 +113,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -126,7 +128,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_workspace_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_workspace_link_operations.py
new file mode 100644
index 000000000000..e1e739e47c25
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_workspace_link_operations.py
@@ -0,0 +1,162 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaceLinks/{workspaceId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class ApiManagementWorkspaceLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`api_management_workspace_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, **kwargs: Any
+ ) -> _models.ApiManagementWorkspaceLinksResource:
+ """Gets an API Management WorkspaceLink resource description.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :return: ApiManagementWorkspaceLinksResource or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiManagementWorkspaceLinksResource
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementWorkspaceLinksResource] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiManagementWorkspaceLinksResource", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_workspace_links_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_workspace_links_operations.py
new file mode 100644
index 000000000000..8391d20fc4c0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_workspace_links_operations.py
@@ -0,0 +1,185 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaceLinks",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class ApiManagementWorkspaceLinksOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`api_management_workspace_links` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> Iterable["_models.ApiManagementWorkspaceLinksResource"]:
+ """List all API Management workspaceLinks for a service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :return: An iterator like instance of either ApiManagementWorkspaceLinksResource or the result
+ of cls(response)
+ :rtype:
+ ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiManagementWorkspaceLinksResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiManagementWorkspaceLinksListResult] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiManagementWorkspaceLinksListResult", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
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 5e83bbee5da7..74c987a93297 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -52,7 +55,7 @@ def build_list_by_api_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -73,7 +76,7 @@ def build_list_by_api_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -101,7 +104,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -123,7 +126,7 @@ def build_get_entity_tag_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -143,7 +146,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -165,7 +168,7 @@ def build_get_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -192,7 +195,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -215,7 +218,7 @@ def build_create_or_update_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -246,7 +249,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -269,7 +272,7 @@ def build_update_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -299,7 +302,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -321,7 +324,7 @@ def build_delete_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -402,7 +405,7 @@ def list_by_api(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -426,7 +429,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -442,7 +444,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -493,7 +494,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -517,7 +518,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -560,7 +560,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.OperationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -584,7 +584,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -602,7 +601,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("OperationContract", pipeline_response)
+ deserialized = self._deserialize("OperationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -721,7 +720,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.OperationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -758,7 +757,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -774,15 +772,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("OperationContract", pipeline_response)
+ deserialized = self._deserialize("OperationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -901,7 +893,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.OperationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -938,7 +930,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -956,7 +947,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("OperationContract", pipeline_response)
+ deserialized = self._deserialize("OperationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -987,7 +978,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1012,7 +1003,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 44a0df196c4a..477a728aa4ab 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -41,7 +44,7 @@ def build_list_by_operation_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -63,7 +66,7 @@ def build_list_by_operation_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -89,7 +92,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -112,7 +115,7 @@ def build_get_entity_tag_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -140,7 +143,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -163,7 +166,7 @@ def build_get_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -193,7 +196,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -217,7 +220,7 @@ def build_create_or_update_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -249,7 +252,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -272,7 +275,7 @@ def build_delete_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -327,7 +330,7 @@ def list_by_operation(
:rtype: ~azure.mgmt.apimanagement.models.PolicyCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -351,7 +354,6 @@ def list_by_operation(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -366,7 +368,7 @@ def list_by_operation(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PolicyCollection", pipeline_response)
+ deserialized = self._deserialize("PolicyCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -402,7 +404,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -427,7 +429,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -482,7 +483,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -508,7 +509,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -526,7 +526,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -654,7 +654,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -692,7 +692,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -708,15 +707,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -756,7 +749,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -782,7 +775,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 476aa94e9030..5bc6968ca417 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -54,7 +59,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -74,7 +79,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -104,7 +109,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -125,7 +130,7 @@ def build_get_entity_tag_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -145,7 +150,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -166,7 +171,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -192,7 +197,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -214,7 +219,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -238,7 +243,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -260,7 +265,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -290,7 +295,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -311,7 +316,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -342,7 +347,7 @@ def build_list_by_tags_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -362,7 +367,7 @@ def build_list_by_tags_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -453,7 +458,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -477,7 +482,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -493,7 +497,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -539,7 +542,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: st
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -562,7 +565,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: st
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -600,7 +602,7 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs
:rtype: ~azure.mgmt.apimanagement.models.ApiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -623,7 +625,6 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -641,7 +642,7 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiContract", pipeline_response)
+ deserialized = self._deserialize("ApiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -656,8 +657,8 @@ def _create_or_update_initial(
parameters: Union[_models.ApiCreateOrUpdateParameter, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.ApiContract]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -670,7 +671,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.ApiContract]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -693,32 +694,33 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = 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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("ApiContract", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -851,14 +853,19 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("ApiContract", pipeline_response)
+ deserialized = self._deserialize("ApiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
@@ -982,7 +989,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.ApiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1018,7 +1025,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1036,15 +1042,14 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiContract", pipeline_response)
+ deserialized = self._deserialize("ApiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
- @distributed_trace
- def delete( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
service_name: str,
@@ -1052,27 +1057,8 @@ def delete( # pylint: disable=inconsistent-return-statements
if_match: str,
delete_revisions: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- """Deletes the specified API of the API Management service instance.
-
- :param resource_group_name: The name of the resource group. The name is case insensitive.
- Required.
- :type resource_group_name: str
- :param service_name: The name of the API Management service. Required.
- :type service_name: str
- :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. Required.
- :type api_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. Required.
- :type if_match: str
- :param delete_revisions: Delete all revisions of the Api. Default value is None.
- :type delete_revisions: bool
- :return: None or the result of cls(response)
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
- """
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1084,7 +1070,7 @@ def delete( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -1097,23 +1083,112 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [200, 204]:
+ if response.status_code not in [202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def begin_delete(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ api_id: str,
+ if_match: str,
+ delete_revisions: Optional[bool] = None,
+ **kwargs: Any
+ ) -> LROPoller[None]:
+ """Deletes the specified API of the API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :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. Required.
+ :type api_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. Required.
+ :type if_match: str
+ :param delete_revisions: Delete all revisions of the Api. Default value is None.
+ :type delete_revisions: bool
+ :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:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._delete_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ api_id=api_id,
+ if_match=if_match,
+ delete_revisions=delete_revisions,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+
+ if polling is True:
+ polling_method: PollingMethod = cast(
+ PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[None].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list_by_tags(
@@ -1160,7 +1235,7 @@ def list_by_tags(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1183,7 +1258,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1199,7 +1273,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 79942f86e7a9..c705eb891412 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -41,7 +44,7 @@ def build_list_by_api_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,7 +65,7 @@ def build_list_by_api_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -87,7 +90,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -109,7 +112,7 @@ def build_get_entity_tag_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -136,7 +139,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop(
"Accept",
"application/json, application/vnd.ms-azure-apim.policy+xml, application/vnd.ms-azure-apim.policy.raw+xml",
@@ -161,7 +164,7 @@ def build_get_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -190,7 +193,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -213,7 +216,7 @@ def build_create_or_update_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -244,7 +247,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -266,7 +269,7 @@ def build_delete_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -318,7 +321,7 @@ def list_by_api(
:rtype: ~azure.mgmt.apimanagement.models.PolicyCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -341,7 +344,6 @@ def list_by_api(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -356,7 +358,7 @@ def list_by_api(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PolicyCollection", pipeline_response)
+ deserialized = self._deserialize("PolicyCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -388,7 +390,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -412,7 +414,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -463,7 +464,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -488,7 +489,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -504,15 +504,9 @@ def get(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -628,7 +622,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -665,7 +659,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -681,15 +674,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -725,7 +712,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -750,7 +737,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 ce925bce9e22..18559aa9ff70 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_apis_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +74,7 @@ def build_list_by_apis_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -150,7 +153,7 @@ def list_by_apis(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ProductCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -173,7 +176,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -189,7 +191,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 26da086fdbee..0de02e185215 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +54,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,7 +75,7 @@ def build_list_by_service_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -98,7 +101,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -122,7 +125,7 @@ def build_get_entity_tag_request(
"releaseId": _SERIALIZER.url(
"release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -142,7 +145,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -166,7 +169,7 @@ def build_get_request(
"releaseId": _SERIALIZER.url(
"release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -193,7 +196,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -218,7 +221,7 @@ def build_create_or_update_request(
"releaseId": _SERIALIZER.url(
"release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -249,7 +252,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -274,7 +277,7 @@ def build_update_request(
"releaseId": _SERIALIZER.url(
"release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -304,7 +307,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -328,7 +331,7 @@ def build_delete_request(
"releaseId": _SERIALIZER.url(
"release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -404,7 +407,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiReleaseCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -427,7 +430,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -443,7 +445,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -494,7 +495,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -518,7 +519,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -561,7 +561,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -585,7 +585,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -603,7 +602,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiReleaseContract", pipeline_response)
+ deserialized = self._deserialize("ApiReleaseContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -722,7 +721,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -759,7 +758,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -775,15 +773,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiReleaseContract", pipeline_response)
+ deserialized = self._deserialize("ApiReleaseContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -902,7 +894,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -939,7 +931,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -957,7 +948,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiReleaseContract", pipeline_response)
+ deserialized = self._deserialize("ApiReleaseContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -988,7 +979,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1013,7 +1004,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 fdd05e6576ab..54592a0771ae 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +74,7 @@ def build_list_by_service_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -150,7 +153,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiRevisionCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -173,7 +176,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -189,7 +191,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 ddef9209f792..70bac56ffd99 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -53,7 +58,7 @@ def build_list_by_api_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -74,7 +79,7 @@ def build_list_by_api_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -100,7 +105,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -122,7 +127,7 @@ def build_get_entity_tag_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -142,7 +147,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -164,7 +169,7 @@ def build_get_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -191,7 +196,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -214,7 +219,7 @@ def build_create_or_update_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -246,7 +251,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -268,7 +273,7 @@ def build_delete_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -344,7 +349,7 @@ def list_by_api(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SchemaCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -367,7 +372,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -383,7 +387,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -434,7 +437,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -458,7 +461,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -501,7 +503,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.SchemaContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -525,7 +527,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -543,7 +544,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("SchemaContract", pipeline_response)
+ deserialized = self._deserialize("SchemaContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -559,8 +560,8 @@ def _create_or_update_initial(
parameters: Union[_models.SchemaContract, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.SchemaContract]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -573,7 +574,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.SchemaContract]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -597,32 +598,33 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = 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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("SchemaContract", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -768,14 +770,19 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("SchemaContract", pipeline_response)
+ deserialized = self._deserialize("SchemaContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
@@ -833,7 +840,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -859,7 +866,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 4bc90e1d8cbb..f5fded05e148 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +54,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,7 +75,7 @@ def build_list_by_service_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -103,7 +106,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -127,7 +130,7 @@ def build_get_entity_tag_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -152,7 +155,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -176,7 +179,7 @@ def build_get_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -203,7 +206,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -228,7 +231,7 @@ def build_create_or_update_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -259,7 +262,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -283,7 +286,7 @@ def build_delete_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -360,7 +363,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagDescriptionCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -383,7 +386,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -399,7 +401,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -450,7 +451,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -474,7 +475,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -517,7 +517,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.TagDescriptionContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -541,7 +541,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -559,7 +558,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagDescriptionContract", pipeline_response)
+ deserialized = self._deserialize("TagDescriptionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -678,7 +677,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.TagDescriptionContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -715,7 +714,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -731,15 +729,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagDescriptionContract", pipeline_response)
+ deserialized = self._deserialize("TagDescriptionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -776,7 +768,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -801,7 +793,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 670236e3bc86..ff3b196ede17 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +73,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -96,7 +99,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,7 +122,7 @@ def build_get_entity_tag_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -139,7 +142,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -162,7 +165,7 @@ def build_get_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -188,7 +191,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -212,7 +215,7 @@ def build_create_or_update_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -242,7 +245,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -266,7 +269,7 @@ def build_update_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -295,7 +298,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -318,7 +321,7 @@ def build_delete_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -388,7 +391,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiVersionSetCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -410,7 +413,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -426,7 +428,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -472,7 +473,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, version_se
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -495,7 +496,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, version_se
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -535,7 +535,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -558,7 +558,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -576,7 +575,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiVersionSetContract", pipeline_response)
+ deserialized = self._deserialize("ApiVersionSetContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -683,7 +682,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -719,7 +718,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -735,15 +733,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiVersionSetContract", pipeline_response)
+ deserialized = self._deserialize("ApiVersionSetContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -850,7 +842,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -886,7 +878,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -904,7 +895,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ApiVersionSetContract", pipeline_response)
+ deserialized = self._deserialize("ApiVersionSetContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -932,7 +923,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -956,7 +947,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wiki_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wiki_operations.py
index e0564c75b516..53b8a99ffa8b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wiki_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wiki_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -41,7 +44,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,7 +65,7 @@ def build_get_entity_tag_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -82,7 +85,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -103,7 +106,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -129,7 +132,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -151,7 +154,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -175,7 +178,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -197,7 +200,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -220,7 +223,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -241,7 +244,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -291,7 +294,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: st
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -314,7 +317,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, api_id: st
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -352,7 +354,7 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs
:rtype: ~azure.mgmt.apimanagement.models.WikiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -375,7 +377,6 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -393,7 +394,7 @@ def get(self, resource_group_name: str, service_name: str, api_id: str, **kwargs
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("WikiContract", pipeline_response)
+ deserialized = self._deserialize("WikiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -500,7 +501,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.WikiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -536,7 +537,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -552,15 +552,9 @@ def create_or_update(
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("WikiContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("WikiContract", pipeline_response)
+ deserialized = self._deserialize("WikiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -667,7 +661,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.WikiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -703,7 +697,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -721,7 +714,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("WikiContract", pipeline_response)
+ deserialized = self._deserialize("WikiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -749,7 +742,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -773,7 +766,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wikis_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wikis_operations.py
index 952e477d27d2..8f7ee331b4c5 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wikis_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_wikis_operations.py
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +74,7 @@ def build_list_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -149,7 +152,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WikiCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -172,7 +175,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -188,7 +190,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_access_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_access_policy_operations.py
index 95cf64cd362c..49d301466aa6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_access_policy_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_access_policy_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -52,7 +55,7 @@ def build_list_by_authorization_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -83,7 +86,7 @@ def build_list_by_authorization_request(
"authorizationId": _SERIALIZER.url(
"authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -115,7 +118,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -154,7 +157,7 @@ def build_get_request(
min_length=1,
pattern=r"^[^*#&+:<>?]+$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -182,7 +185,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -222,7 +225,7 @@ def build_create_or_update_request(
min_length=1,
pattern=r"^[^*#&+:<>?]+$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -254,7 +257,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -293,7 +296,7 @@ def build_delete_request(
min_length=1,
pattern=r"^[^*#&+:<>?]+$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -372,7 +375,7 @@ def list_by_authorization(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AuthorizationAccessPolicyCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -396,7 +399,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -412,7 +414,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -469,7 +470,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -494,7 +495,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -512,7 +512,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -635,7 +635,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationAccessPolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -673,7 +673,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -689,15 +688,9 @@ def create_or_update(
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("AuthorizationAccessPolicyContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationAccessPolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -735,7 +728,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -761,7 +754,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_login_links_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_login_links_operations.py
index 8458e416f305..638459b6ecd9 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_login_links_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_login_links_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -46,7 +49,7 @@ def build_post_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -78,7 +81,7 @@ def build_post_request(
"authorizationId": _SERIALIZER.url(
"authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -208,7 +211,7 @@ def post(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationLoginResponseContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -244,7 +247,6 @@ def post(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -262,7 +264,7 @@ def post(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationLoginResponseContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationLoginResponseContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_operations.py
index c6dee0f2b56d..c844abb20e2b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +54,7 @@ def build_list_by_authorization_provider_request( # pylint: disable=name-too-lo
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -79,7 +82,7 @@ def build_list_by_authorization_provider_request( # pylint: disable=name-too-lo
min_length=1,
pattern=r"^[^*#&+:<>?]+$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -110,7 +113,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -141,7 +144,7 @@ def build_get_request(
"authorizationId": _SERIALIZER.url(
"authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -168,7 +171,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -200,7 +203,7 @@ def build_create_or_update_request(
"authorizationId": _SERIALIZER.url(
"authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -231,7 +234,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -262,7 +265,7 @@ def build_delete_request(
"authorizationId": _SERIALIZER.url(
"authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -288,7 +291,7 @@ def build_confirm_consent_code_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -320,7 +323,7 @@ def build_confirm_consent_code_request(
"authorizationId": _SERIALIZER.url(
"authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -396,7 +399,7 @@ def list_by_authorization_provider(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AuthorizationCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -419,7 +422,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -435,7 +437,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -489,7 +490,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -513,7 +514,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -531,7 +531,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -644,7 +644,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -681,7 +681,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -697,15 +696,9 @@ def create_or_update(
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("AuthorizationContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -740,7 +733,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -765,7 +758,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -879,7 +871,7 @@ def confirm_consent_code( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -915,7 +907,6 @@ def confirm_consent_code( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_provider_operations.py
index 6d2cb523a323..8e9aa1640dc0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_provider_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_provider_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +73,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -96,7 +99,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -124,7 +127,7 @@ def build_get_request(
min_length=1,
pattern=r"^[^*#&+:<>?]+$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -150,7 +153,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -179,7 +182,7 @@ def build_create_or_update_request(
min_length=1,
pattern=r"^[^*#&+:<>?]+$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -209,7 +212,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -237,7 +240,7 @@ def build_delete_request(
min_length=1,
pattern=r"^[^*#&+:<>?]+$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -310,7 +313,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AuthorizationProviderCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -332,7 +335,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -348,7 +350,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -395,7 +396,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -418,7 +419,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -436,7 +436,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -540,7 +540,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -576,7 +576,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -592,15 +591,9 @@ def create_or_update(
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("AuthorizationProviderContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -627,7 +620,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -651,7 +644,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 540201ef5749..8dc969ce0f08 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +73,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -96,7 +99,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -117,7 +120,7 @@ def build_get_entity_tag_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -137,7 +140,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -158,7 +161,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -184,7 +187,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -206,7 +209,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -230,7 +233,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -252,7 +255,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -275,7 +278,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -296,7 +299,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -317,7 +320,7 @@ def build_list_secrets_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -338,7 +341,7 @@ def build_list_secrets_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -410,7 +413,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AuthorizationServerCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -432,7 +435,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -448,7 +450,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -493,7 +494,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, authsid: s
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -516,7 +517,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, authsid: s
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -555,7 +555,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -578,7 +578,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -596,7 +595,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationServerContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationServerContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -700,7 +699,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -736,7 +735,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -752,15 +750,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationServerContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationServerContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -865,7 +857,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -901,7 +893,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -919,7 +910,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationServerContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationServerContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -946,7 +937,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -970,7 +961,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1005,7 +995,7 @@ def list_secrets(
:rtype: ~azure.mgmt.apimanagement.models.AuthorizationServerSecretsContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1028,7 +1018,6 @@ def list_secrets(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1046,7 +1035,7 @@ def list_secrets(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AuthorizationServerSecretsContract", pipeline_response)
+ deserialized = self._deserialize("AuthorizationServerSecretsContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # 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 077c1a99daad..a5b04113b93c 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +73,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -96,7 +99,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -117,7 +120,7 @@ def build_get_entity_tag_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -137,7 +140,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -158,7 +161,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -184,7 +187,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -206,7 +209,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -230,7 +233,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -252,7 +255,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -275,7 +278,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -296,7 +299,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -317,7 +320,7 @@ def build_reconnect_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -339,7 +342,7 @@ def build_reconnect_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -412,7 +415,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.BackendCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -434,7 +437,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -450,7 +452,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -496,7 +497,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, backend_id
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -519,7 +520,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, backend_id
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -559,7 +559,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.BackendContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -582,7 +582,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -600,7 +599,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("BackendContract", pipeline_response)
+ deserialized = self._deserialize("BackendContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -707,7 +706,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.BackendContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -743,7 +742,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -759,15 +757,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("BackendContract", pipeline_response)
+ deserialized = self._deserialize("BackendContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -874,7 +866,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.BackendContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -910,7 +902,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -928,7 +919,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("BackendContract", pipeline_response)
+ deserialized = self._deserialize("BackendContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -956,7 +947,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -980,7 +971,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1089,7 +1079,7 @@ def reconnect( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1127,7 +1117,6 @@ def reconnect( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 9fb0b089c747..8b3fe558f89d 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,7 +52,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,7 +72,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -93,7 +96,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -114,7 +117,7 @@ def build_get_entity_tag_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -134,7 +137,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -155,7 +158,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -181,7 +184,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -203,7 +206,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -227,7 +230,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -249,7 +252,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -272,7 +275,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -293,7 +296,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -357,7 +360,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CacheCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -378,7 +381,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -394,7 +396,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -440,7 +441,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, cache_id:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -463,7 +464,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, cache_id:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -501,7 +501,7 @@ def get(self, resource_group_name: str, service_name: str, cache_id: str, **kwar
:rtype: ~azure.mgmt.apimanagement.models.CacheContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -524,7 +524,6 @@ def get(self, resource_group_name: str, service_name: str, cache_id: str, **kwar
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -542,7 +541,7 @@ def get(self, resource_group_name: str, service_name: str, cache_id: str, **kwar
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("CacheContract", pipeline_response)
+ deserialized = self._deserialize("CacheContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -658,7 +657,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.CacheContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -694,7 +693,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -710,15 +708,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("CacheContract", pipeline_response)
+ deserialized = self._deserialize("CacheContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -825,7 +817,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.CacheContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -861,7 +853,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -879,7 +870,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("CacheContract", pipeline_response)
+ deserialized = self._deserialize("CacheContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -907,7 +898,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -931,7 +922,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 951dd6574581..24f566b324dd 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +54,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +74,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -101,7 +104,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -124,7 +127,7 @@ def build_get_entity_tag_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -144,7 +147,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -167,7 +170,7 @@ def build_get_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -193,7 +196,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -217,7 +220,7 @@ def build_create_or_update_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -247,7 +250,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -270,7 +273,7 @@ def build_delete_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -291,7 +294,7 @@ def build_refresh_secret_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -314,7 +317,7 @@ def build_refresh_secret_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -389,7 +392,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CertificateCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -412,7 +415,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -428,7 +430,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -474,7 +475,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, certificat
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -497,7 +498,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, certificat
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -537,7 +537,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.CertificateContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -560,7 +560,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -578,7 +577,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("CertificateContract", pipeline_response)
+ deserialized = self._deserialize("CertificateContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -698,7 +697,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.CertificateContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -734,7 +733,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -750,15 +748,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("CertificateContract", pipeline_response)
+ deserialized = self._deserialize("CertificateContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -786,7 +778,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -810,7 +802,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -850,7 +841,7 @@ def refresh_secret(
:rtype: ~azure.mgmt.apimanagement.models.CertificateContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -873,7 +864,6 @@ def refresh_secret(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -891,7 +881,7 @@ def refresh_secret(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("CertificateContract", pipeline_response)
+ deserialized = self._deserialize("CertificateContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # 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 61993a3adead..c1a2b63651c6 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +46,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -64,7 +67,7 @@ def build_list_by_service_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -89,7 +92,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -111,7 +114,7 @@ def build_get_entity_tag_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -136,7 +139,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -158,7 +161,7 @@ def build_get_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -185,7 +188,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -208,7 +211,7 @@ def build_create_or_update_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -239,7 +242,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -261,7 +264,7 @@ def build_delete_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -318,7 +321,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ContentItemCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -338,7 +341,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -354,7 +356,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -404,7 +405,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -428,7 +429,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -469,7 +469,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.ContentItemContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -493,7 +493,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -511,7 +510,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ContentItemContract", pipeline_response)
+ deserialized = self._deserialize("ContentItemContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -624,7 +623,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ContentItemContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -661,7 +660,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -677,15 +675,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ContentItemContract", pipeline_response)
+ deserialized = self._deserialize("ContentItemContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -720,7 +712,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -745,7 +737,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 d8f9d7e5aceb..ce7ca8f03979 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +46,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -63,7 +66,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -83,7 +86,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -104,7 +107,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -130,7 +133,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -152,7 +155,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -182,7 +185,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -203,7 +206,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -259,7 +262,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ContentTypeCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -278,7 +281,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -294,7 +296,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -342,7 +343,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.ContentTypeContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -365,7 +366,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -383,7 +383,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ContentTypeContract", pipeline_response)
+ deserialized = self._deserialize("ContentTypeContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -493,7 +493,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ContentTypeContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -529,7 +529,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -545,15 +544,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ContentTypeContract", pipeline_response)
+ deserialized = self._deserialize("ContentTypeContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -582,7 +575,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -606,7 +599,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 ab37ece18239..2a769626c5c4 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -41,7 +44,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -61,7 +64,7 @@ def build_get_entity_tag_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -79,7 +82,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -99,7 +102,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -119,7 +122,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -140,7 +143,7 @@ def build_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -163,7 +166,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -184,7 +187,7 @@ def build_create_or_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -208,7 +211,7 @@ def build_list_secrets_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -228,7 +231,7 @@ def build_list_secrets_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -274,7 +277,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -296,7 +299,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -331,7 +333,7 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo
:rtype: ~azure.mgmt.apimanagement.models.PortalDelegationSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -353,7 +355,6 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -371,7 +372,7 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PortalDelegationSettings", pipeline_response)
+ deserialized = self._deserialize("PortalDelegationSettings", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -466,7 +467,7 @@ def update( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -501,7 +502,6 @@ def update( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -607,7 +607,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PortalDelegationSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -642,7 +642,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -657,7 +656,7 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PortalDelegationSettings", pipeline_response)
+ deserialized = self._deserialize("PortalDelegationSettings", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -679,7 +678,7 @@ def list_secrets(
:rtype: ~azure.mgmt.apimanagement.models.PortalSettingValidationKeyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -701,7 +700,6 @@ def list_secrets(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -716,7 +714,7 @@ def list_secrets(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PortalSettingValidationKeyContract", pipeline_response)
+ deserialized = self._deserialize("PortalSettingValidationKeyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 d2ca5479aa3c..2fb5f7c0567f 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast
+import sys
+from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast
import urllib.parse
from azure.core.exceptions import (
@@ -15,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -29,8 +31,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -42,7 +47,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -50,7 +55,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices"
)
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -68,7 +73,7 @@ def build_get_by_name_request(service_name: str, location: str, subscription_id:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -85,7 +90,7 @@ def build_get_by_name_request(service_name: str, location: str, subscription_id:
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"location": _SERIALIZER.url("location", location, "str"),
}
@@ -104,7 +109,7 @@ def build_purge_request(service_name: str, location: str, subscription_id: str,
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -121,7 +126,7 @@ def build_purge_request(service_name: str, location: str, subscription_id: str,
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"location": _SERIALIZER.url("location", location, "str"),
}
@@ -170,7 +175,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.DeletedServic
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DeletedServicesCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -187,7 +192,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -203,7 +207,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -245,7 +248,7 @@ def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> _model
:rtype: ~azure.mgmt.apimanagement.models.DeletedServiceContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -267,7 +270,6 @@ def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> _model
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -282,17 +284,15 @@ def get_by_name(self, service_name: str, location: str, **kwargs: Any) -> _model
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeletedServiceContract", pipeline_response)
+ deserialized = self._deserialize("DeletedServiceContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- def _purge_initial(
- self, service_name: str, location: str, **kwargs: Any
- ) -> Optional[_models.DeletedServiceContract]:
- error_map = {
+ def _purge_initial(self, service_name: str, location: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -304,7 +304,7 @@ def _purge_initial(
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[Optional[_models.DeletedServiceContract]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_purge_request(
service_name=service_name,
@@ -314,10 +314,10 @@ def _purge_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -325,16 +325,19 @@ def _purge_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
response_headers = {}
if response.status_code == 202:
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
- deserialized = self._deserialize("DeletedServiceContract", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -372,6 +375,7 @@ def begin_purge(self, service_name: str, location: str, **kwargs: Any) -> LROPol
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
@@ -379,7 +383,7 @@ def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
response_headers["location"] = self._deserialize("str", response.headers.get("location"))
- deserialized = self._deserialize("DeletedServiceContract", pipeline_response)
+ deserialized = self._deserialize("DeletedServiceContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
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 ca50590197ed..0278d12fb499 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +73,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -96,7 +99,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,7 +122,7 @@ def build_get_entity_tag_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -139,7 +142,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -162,7 +165,7 @@ def build_get_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -188,7 +191,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -212,7 +215,7 @@ def build_create_or_update_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -242,7 +245,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -266,7 +269,7 @@ def build_update_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -295,7 +298,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -318,7 +321,7 @@ def build_delete_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -388,7 +391,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DiagnosticCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -410,7 +413,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -426,7 +428,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -472,7 +473,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, diagnostic
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -495,7 +496,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, diagnostic
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -535,7 +535,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -558,7 +558,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -576,7 +575,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DiagnosticContract", pipeline_response)
+ deserialized = self._deserialize("DiagnosticContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -683,7 +682,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -719,7 +718,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -735,15 +733,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DiagnosticContract", pipeline_response)
+ deserialized = self._deserialize("DiagnosticContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -850,7 +842,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -886,7 +878,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -904,7 +895,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DiagnosticContract", pipeline_response)
+ deserialized = self._deserialize("DiagnosticContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -932,7 +923,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -956,7 +947,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_documentation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_documentation_operations.py
index a3f8fa923115..8a28b7082900 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_documentation_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_documentation_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +73,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -96,7 +99,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,7 +122,7 @@ def build_get_entity_tag_request(
"documentationId": _SERIALIZER.url(
"documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -139,7 +142,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -162,7 +165,7 @@ def build_get_request(
"documentationId": _SERIALIZER.url(
"documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -188,7 +191,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -212,7 +215,7 @@ def build_create_or_update_request(
"documentationId": _SERIALIZER.url(
"documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -242,7 +245,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -266,7 +269,7 @@ def build_update_request(
"documentationId": _SERIALIZER.url(
"documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -295,7 +298,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -318,7 +321,7 @@ def build_delete_request(
"documentationId": _SERIALIZER.url(
"documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -388,7 +391,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DocumentationCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -410,7 +413,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -426,7 +428,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -472,7 +473,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, documentat
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -495,7 +496,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, documentat
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -535,7 +535,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.DocumentationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -558,7 +558,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -576,7 +575,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DocumentationContract", pipeline_response)
+ deserialized = self._deserialize("DocumentationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -683,7 +682,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.DocumentationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -719,7 +718,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -735,15 +733,9 @@ def create_or_update(
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("DocumentationContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DocumentationContract", pipeline_response)
+ deserialized = self._deserialize("DocumentationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -850,7 +842,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.DocumentationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -886,7 +878,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -904,7 +895,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("DocumentationContract", pipeline_response)
+ deserialized = self._deserialize("DocumentationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -932,7 +923,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -956,7 +947,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 6329a5cb4fe8..b5c2676c563d 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +73,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -100,7 +103,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -121,7 +124,7 @@ def build_get_entity_tag_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -145,7 +148,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -166,7 +169,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -192,7 +195,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -214,7 +217,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -244,7 +247,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -266,7 +269,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -295,7 +298,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -316,7 +319,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -387,7 +390,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EmailTemplateCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -409,7 +412,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -425,7 +427,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -483,7 +484,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -506,7 +507,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -556,7 +556,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -579,7 +579,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -597,7 +596,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("EmailTemplateContract", pipeline_response)
+ deserialized = self._deserialize("EmailTemplateContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -722,7 +721,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -758,7 +757,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -773,11 +771,7 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("EmailTemplateContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EmailTemplateContract", pipeline_response)
+ deserialized = self._deserialize("EmailTemplateContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -902,7 +896,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.EmailTemplateContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -938,7 +932,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -956,7 +949,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("EmailTemplateContract", pipeline_response)
+ deserialized = self._deserialize("EmailTemplateContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -995,7 +988,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1019,7 +1012,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 28885b7ab3fa..869abb4016a1 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +54,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,7 +75,7 @@ def build_list_by_service_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -98,7 +101,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -120,7 +123,7 @@ def build_get_entity_tag_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -140,7 +143,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -163,7 +166,7 @@ def build_create_or_update_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -185,7 +188,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -207,7 +210,7 @@ def build_delete_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -280,7 +283,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -303,7 +306,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -319,7 +321,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -370,7 +371,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -394,7 +395,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -516,7 +516,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ApiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -555,7 +555,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -570,11 +569,7 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("ApiContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ApiContract", pipeline_response)
+ deserialized = self._deserialize("ApiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -602,7 +597,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -626,7 +621,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 5433df4c9733..cf17d7d5d0d0 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +54,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,7 +75,7 @@ def build_list_by_service_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -103,7 +106,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -127,7 +130,7 @@ def build_get_entity_tag_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -152,7 +155,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -176,7 +179,7 @@ def build_get_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -203,7 +206,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -228,7 +231,7 @@ def build_create_or_update_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -259,7 +262,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -283,7 +286,7 @@ def build_delete_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -358,7 +361,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GatewayCertificateAuthorityCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -381,7 +384,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -397,7 +399,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -448,7 +449,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -472,7 +473,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -515,7 +515,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -539,7 +539,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -557,7 +556,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayCertificateAuthorityContract", pipeline_response)
+ deserialized = self._deserialize("GatewayCertificateAuthorityContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -677,7 +676,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -714,7 +713,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -730,15 +728,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayCertificateAuthorityContract", pipeline_response)
+ deserialized = self._deserialize("GatewayCertificateAuthorityContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -775,7 +767,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -800,7 +792,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 f8cb8c8d17ce..430848c1d95d 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +54,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,7 +75,7 @@ def build_list_by_service_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -98,7 +101,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -120,7 +123,7 @@ def build_get_entity_tag_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -140,7 +143,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -162,7 +165,7 @@ def build_get_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -189,7 +192,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -212,7 +215,7 @@ def build_create_or_update_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -243,7 +246,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -265,7 +268,7 @@ def build_delete_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -342,7 +345,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GatewayHostnameConfigurationCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -365,7 +368,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -381,7 +383,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -433,7 +434,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -457,7 +458,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -500,7 +500,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -524,7 +524,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -542,7 +541,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayHostnameConfigurationContract", pipeline_response)
+ deserialized = self._deserialize("GatewayHostnameConfigurationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -662,7 +661,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -699,7 +698,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -715,15 +713,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayHostnameConfigurationContract", pipeline_response)
+ deserialized = self._deserialize("GatewayHostnameConfigurationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -754,7 +746,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -779,7 +771,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 c2f420414748..4fbd605f610c 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +73,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -96,7 +99,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -117,7 +120,7 @@ def build_get_entity_tag_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -137,7 +140,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -158,7 +161,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -184,7 +187,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -206,7 +209,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -230,7 +233,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -252,7 +255,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -275,7 +278,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -296,7 +299,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -317,7 +320,7 @@ def build_list_keys_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -338,7 +341,7 @@ def build_list_keys_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -358,7 +361,7 @@ def build_regenerate_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -380,7 +383,7 @@ def build_regenerate_key_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -402,7 +405,7 @@ def build_generate_token_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -424,7 +427,136 @@ def build_generate_token_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_invalidate_debug_credentials_request( # pylint: disable=name-too-long
+ resource_group_name: str, service_name: str, gateway_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/invalidateDebugCredentials",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_list_debug_credentials_request(
+ resource_group_name: str, service_name: str, gateway_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listDebugCredentials",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_list_trace_request(
+ resource_group_name: str, service_name: str, gateway_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listTrace",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -497,7 +629,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GatewayCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -519,7 +651,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -535,7 +666,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -581,7 +711,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, gateway_id
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -604,7 +734,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, gateway_id
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -644,7 +773,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.GatewayContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -667,7 +796,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -685,7 +813,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayContract", pipeline_response)
+ deserialized = self._deserialize("GatewayContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -791,7 +919,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.GatewayContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -827,7 +955,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -843,15 +970,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayContract", pipeline_response)
+ deserialized = self._deserialize("GatewayContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -957,7 +1078,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.GatewayContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -993,7 +1114,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1011,7 +1131,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayContract", pipeline_response)
+ deserialized = self._deserialize("GatewayContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1039,7 +1159,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1063,7 +1183,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1099,7 +1218,7 @@ def list_keys(
:rtype: ~azure.mgmt.apimanagement.models.GatewayKeysContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1122,7 +1241,6 @@ def list_keys(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1140,7 +1258,7 @@ def list_keys(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GatewayKeysContract", pipeline_response)
+ deserialized = self._deserialize("GatewayKeysContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1236,7 +1354,7 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1271,7 +1389,6 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1376,7 +1493,7 @@ def generate_token(
:rtype: ~azure.mgmt.apimanagement.models.GatewayTokenContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1411,7 +1528,6 @@ def generate_token(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1426,7 +1542,354 @@ def generate_token(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("GatewayTokenContract", pipeline_response)
+ deserialized = self._deserialize("GatewayTokenContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def invalidate_debug_credentials( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, gateway_id: str, **kwargs: Any
+ ) -> None:
+ """Action is invalidating all debug credentials issued for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_invalidate_debug_credentials_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ gateway_id=gateway_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+
+ @overload
+ def list_debug_credentials(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: _models.GatewayListDebugCredentialsContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GatewayDebugCredentialsContract:
+ """Create new debug credentials for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List debug credentials properties. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListDebugCredentialsContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: GatewayDebugCredentialsContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GatewayDebugCredentialsContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def list_debug_credentials(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GatewayDebugCredentialsContract:
+ """Create new debug credentials for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List debug credentials properties. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: GatewayDebugCredentialsContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GatewayDebugCredentialsContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def list_debug_credentials(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: Union[_models.GatewayListDebugCredentialsContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.GatewayDebugCredentialsContract:
+ """Create new debug credentials for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List debug credentials properties. Is either a
+ GatewayListDebugCredentialsContract type or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListDebugCredentialsContract or
+ IO[bytes]
+ :return: GatewayDebugCredentialsContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GatewayDebugCredentialsContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.GatewayDebugCredentialsContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GatewayListDebugCredentialsContract")
+
+ _request = build_list_debug_credentials_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ gateway_id=gateway_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("GatewayDebugCredentialsContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def list_trace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: _models.GatewayListTraceContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Dict[str, Any]:
+ """Fetches trace collected by gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List trace properties. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListTraceContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: dict mapping str to any or the result of cls(response)
+ :rtype: dict[str, any]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def list_trace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Dict[str, Any]:
+ """Fetches trace collected by gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List trace properties. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: dict mapping str to any or the result of cls(response)
+ :rtype: dict[str, any]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def list_trace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: Union[_models.GatewayListTraceContract, IO[bytes]],
+ **kwargs: Any
+ ) -> Dict[str, Any]:
+ """Fetches trace collected by gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List trace properties. Is either a GatewayListTraceContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListTraceContract or IO[bytes]
+ :return: dict mapping str to any or the result of cls(response)
+ :rtype: dict[str, any]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[Dict[str, Any]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GatewayListTraceContract")
+
+ _request = build_list_trace_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ gateway_id=gateway_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("{object}", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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
index c98d4a466ec2..4346401eacdf 100644
--- 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -52,7 +57,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,7 +77,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -98,7 +103,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,7 +124,7 @@ def build_get_entity_tag_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -139,7 +144,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -160,7 +165,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -186,7 +191,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -208,7 +213,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -232,7 +237,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -253,7 +258,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -324,7 +329,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GlobalSchemaCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -346,7 +351,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -362,7 +366,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -408,7 +411,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, schema_id:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -431,7 +434,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, schema_id:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -471,7 +473,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.GlobalSchemaContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -494,7 +496,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -512,7 +513,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -527,8 +528,8 @@ def _create_or_update_initial(
parameters: Union[_models.GlobalSchemaContract, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.GlobalSchemaContract]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -541,7 +542,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.GlobalSchemaContract]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -564,32 +565,33 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = 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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -722,14 +724,19 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
@@ -774,7 +781,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -798,7 +805,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_operations.py
index 65c1d2606de9..10402037ca84 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +54,7 @@ def build_list_by_api_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,7 +75,7 @@ def build_list_by_api_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -98,7 +101,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -120,7 +123,7 @@ def build_get_entity_tag_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -140,7 +143,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -162,7 +165,7 @@ def build_get_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -189,7 +192,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -212,7 +215,7 @@ def build_create_or_update_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -243,7 +246,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -266,7 +269,7 @@ def build_update_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -296,7 +299,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -318,7 +321,7 @@ def build_delete_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -395,7 +398,7 @@ def list_by_api(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ResolverCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -418,7 +421,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -434,7 +436,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -485,7 +486,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -509,7 +510,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -552,7 +552,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.ResolverContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -576,7 +576,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -594,7 +593,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ResolverContract", pipeline_response)
+ deserialized = self._deserialize("ResolverContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -713,7 +712,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ResolverContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -750,7 +749,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -766,15 +764,9 @@ def create_or_update(
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("ResolverContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ResolverContract", pipeline_response)
+ deserialized = self._deserialize("ResolverContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -893,7 +885,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.ResolverContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -930,7 +922,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -948,7 +939,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ResolverContract", pipeline_response)
+ deserialized = self._deserialize("ResolverContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -979,7 +970,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1004,7 +995,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_policy_operations.py
index 3c057a54e7da..b1916c5b7e4b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_policy_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_graph_ql_api_resolver_policy_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +46,7 @@ def build_list_by_resolver_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -65,7 +68,7 @@ def build_list_by_resolver_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -91,7 +94,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -114,7 +117,7 @@ def build_get_entity_tag_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -142,7 +145,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -165,7 +168,7 @@ def build_get_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -195,7 +198,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -219,7 +222,7 @@ def build_create_or_update_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -251,7 +254,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -274,7 +277,7 @@ def build_delete_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -335,7 +338,7 @@ def list_by_resolver(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -356,7 +359,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -372,7 +374,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -432,7 +433,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -457,7 +458,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -512,7 +512,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -538,7 +538,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -556,7 +555,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -684,7 +683,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -722,7 +721,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -738,15 +736,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -786,7 +778,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -812,7 +804,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 98474003b482..dbe6042d52c7 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +73,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -96,7 +99,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -117,7 +120,7 @@ def build_get_entity_tag_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -137,7 +140,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -158,7 +161,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -184,7 +187,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -206,7 +209,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -230,7 +233,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -252,7 +255,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -275,7 +278,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -296,7 +299,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -371,7 +374,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GroupCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -393,7 +396,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -409,7 +411,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -455,7 +456,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, group_id:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -478,7 +479,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, group_id:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -516,7 +516,7 @@ def get(self, resource_group_name: str, service_name: str, group_id: str, **kwar
:rtype: ~azure.mgmt.apimanagement.models.GroupContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -539,7 +539,6 @@ def get(self, resource_group_name: str, service_name: str, group_id: str, **kwar
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -557,7 +556,7 @@ def get(self, resource_group_name: str, service_name: str, group_id: str, **kwar
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GroupContract", pipeline_response)
+ deserialized = self._deserialize("GroupContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -664,7 +663,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.GroupContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -700,7 +699,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -716,15 +714,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GroupContract", pipeline_response)
+ deserialized = self._deserialize("GroupContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -831,7 +823,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.GroupContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -867,7 +859,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -885,7 +876,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("GroupContract", pipeline_response)
+ deserialized = self._deserialize("GroupContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -913,7 +904,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -937,7 +928,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 dfd484e2f246..25b55788e2d7 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +74,7 @@ def build_list_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -97,7 +100,7 @@ def build_check_entity_exists_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,7 +122,7 @@ def build_check_entity_exists_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -139,7 +142,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -161,7 +164,7 @@ def build_create_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -181,7 +184,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -203,7 +206,7 @@ def build_delete_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -280,7 +283,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.UserCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -303,7 +306,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -319,7 +321,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -370,7 +371,7 @@ def check_entity_exists(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -394,7 +395,6 @@ def check_entity_exists(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -434,7 +434,7 @@ def create(
:rtype: ~azure.mgmt.apimanagement.models.UserContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -458,7 +458,6 @@ def create(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -473,11 +472,7 @@ def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("UserContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("UserContract", pipeline_response)
+ deserialized = self._deserialize("UserContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -505,7 +500,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -529,7 +524,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 d2911956e421..b5c9cf6c9371 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +46,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -63,7 +66,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -87,7 +90,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -108,7 +111,7 @@ def build_get_entity_tag_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -132,7 +135,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -153,7 +156,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -179,7 +182,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -201,7 +204,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -231,7 +234,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -253,7 +256,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -282,7 +285,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -303,7 +306,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -328,7 +331,7 @@ def build_list_secrets_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -349,7 +352,7 @@ def build_list_secrets_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -408,7 +411,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.IdentityProviderList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -427,7 +430,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -443,7 +445,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -495,7 +496,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -518,7 +519,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -563,7 +563,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -586,7 +586,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -604,7 +603,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IdentityProviderContract", pipeline_response)
+ deserialized = self._deserialize("IdentityProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -711,7 +710,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -747,7 +746,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -763,15 +761,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IdentityProviderContract", pipeline_response)
+ deserialized = self._deserialize("IdentityProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -879,7 +871,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.IdentityProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -915,7 +907,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -933,7 +924,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IdentityProviderContract", pipeline_response)
+ deserialized = self._deserialize("IdentityProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -966,7 +957,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -990,7 +981,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1030,7 +1020,7 @@ def list_secrets(
:rtype: ~azure.mgmt.apimanagement.models.ClientSecretContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1053,7 +1043,6 @@ def list_secrets(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1071,7 +1060,7 @@ def list_secrets(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ClientSecretContract", pipeline_response)
+ deserialized = self._deserialize("ClientSecretContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # 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 2544e79f662f..e6768249db04 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,7 +52,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,7 +72,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -95,7 +98,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -118,7 +121,7 @@ def build_get_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -191,7 +194,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.IssueCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -213,7 +216,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -229,7 +231,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -275,7 +276,7 @@ def get(self, resource_group_name: str, service_name: str, issue_id: str, **kwar
:rtype: ~azure.mgmt.apimanagement.models.IssueContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -298,7 +299,6 @@ def get(self, resource_group_name: str, service_name: str, issue_id: str, **kwar
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -316,7 +316,7 @@ def get(self, resource_group_name: str, service_name: str, issue_id: str, **kwar
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("IssueContract", pipeline_response)
+ deserialized = self._deserialize("IssueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # 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 282deb89a865..f670369a3fd2 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +73,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -96,7 +99,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -117,7 +120,7 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -137,7 +140,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -158,7 +161,7 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -184,7 +187,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -206,7 +209,7 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -230,7 +233,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -252,7 +255,7 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -275,7 +278,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -296,7 +299,7 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -371,7 +374,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.LoggerCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -393,7 +396,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -409,7 +411,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -455,7 +456,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, logger_id:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -478,7 +479,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, logger_id:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -516,7 +516,7 @@ def get(self, resource_group_name: str, service_name: str, logger_id: str, **kwa
:rtype: ~azure.mgmt.apimanagement.models.LoggerContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -539,7 +539,6 @@ def get(self, resource_group_name: str, service_name: str, logger_id: str, **kwa
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -557,7 +556,7 @@ def get(self, resource_group_name: str, service_name: str, logger_id: str, **kwa
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("LoggerContract", pipeline_response)
+ deserialized = self._deserialize("LoggerContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -664,7 +663,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.LoggerContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -700,7 +699,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -716,15 +714,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("LoggerContract", pipeline_response)
+ deserialized = self._deserialize("LoggerContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -831,7 +823,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.LoggerContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -867,7 +859,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -885,7 +876,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("LoggerContract", pipeline_response)
+ deserialized = self._deserialize("LoggerContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -913,7 +904,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -937,7 +928,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 fc2acf5894a2..e5033815f6bc 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -53,7 +58,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -73,7 +78,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -103,7 +108,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -126,7 +131,7 @@ def build_get_entity_tag_request(
"namedValueId": _SERIALIZER.url(
"named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -146,7 +151,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -169,7 +174,7 @@ def build_get_request(
"namedValueId": _SERIALIZER.url(
"named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -195,7 +200,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -219,7 +224,7 @@ def build_create_or_update_request(
"namedValueId": _SERIALIZER.url(
"named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -249,7 +254,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -273,7 +278,7 @@ def build_update_request(
"namedValueId": _SERIALIZER.url(
"named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -302,7 +307,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -325,7 +330,7 @@ def build_delete_request(
"namedValueId": _SERIALIZER.url(
"named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -346,7 +351,7 @@ def build_list_value_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -369,7 +374,7 @@ def build_list_value_request(
"namedValueId": _SERIALIZER.url(
"named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -389,7 +394,7 @@ def build_refresh_secret_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -412,7 +417,7 @@ def build_refresh_secret_request(
"namedValueId": _SERIALIZER.url(
"named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -489,7 +494,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.NamedValueCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -512,7 +517,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -528,7 +532,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -573,7 +576,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, named_valu
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -596,7 +599,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, named_valu
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -635,7 +637,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.NamedValueContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -658,7 +660,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -676,7 +677,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ deserialized = self._deserialize("NamedValueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -691,8 +692,8 @@ def _create_or_update_initial(
parameters: Union[_models.NamedValueCreateContract, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.NamedValueContract]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -705,7 +706,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -728,32 +729,33 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = 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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -883,14 +885,19 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ deserialized = self._deserialize("NamedValueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
@@ -922,8 +929,8 @@ def _update_initial(
if_match: str,
parameters: Union[_models.NamedValueUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.NamedValueContract]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -936,7 +943,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -959,10 +966,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -970,16 +977,25 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = 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 == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1109,6 +1125,7 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
@@ -1116,7 +1133,7 @@ def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ deserialized = self._deserialize("NamedValueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
@@ -1160,7 +1177,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1184,7 +1201,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1219,7 +1235,7 @@ def list_value(
:rtype: ~azure.mgmt.apimanagement.models.NamedValueSecretContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1242,7 +1258,6 @@ def list_value(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1260,7 +1275,7 @@ def list_value(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("NamedValueSecretContract", pipeline_response)
+ deserialized = self._deserialize("NamedValueSecretContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1269,8 +1284,8 @@ def list_value(
def _refresh_secret_initial(
self, resource_group_name: str, service_name: str, named_value_id: str, **kwargs: Any
- ) -> Optional[_models.NamedValueContract]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1282,7 +1297,7 @@ def _refresh_secret_initial(
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_refresh_secret_request(
resource_group_name=resource_group_name,
@@ -1293,10 +1308,10 @@ def _refresh_secret_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -1304,16 +1319,25 @@ def _refresh_secret_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = 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 == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1357,6 +1381,7 @@ def begin_refresh_secret(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
@@ -1364,7 +1389,7 @@ def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ deserialized = self._deserialize("NamedValueContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
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 8e6fb3339d2b..0e89105c2b95 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, List, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, List, Optional, Type, TypeVar
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,16 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +43,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -49,7 +52,7 @@ def build_list_by_service_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -80,7 +83,7 @@ def build_list_by_location_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -89,7 +92,7 @@ def build_list_by_location_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -151,7 +154,7 @@ def list_by_service(
:rtype: list[~azure.mgmt.apimanagement.models.NetworkStatusContractByLocation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -173,7 +176,6 @@ def list_by_service(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -188,7 +190,7 @@ def list_by_service(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("[NetworkStatusContractByLocation]", pipeline_response)
+ deserialized = self._deserialize("[NetworkStatusContractByLocation]", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -215,7 +217,7 @@ def list_by_location(
:rtype: ~azure.mgmt.apimanagement.models.NetworkStatusContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -238,7 +240,6 @@ def list_by_location(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -253,7 +254,7 @@ def list_by_location(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NetworkStatusContract", pipeline_response)
+ deserialized = self._deserialize("NetworkStatusContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 49841dd6dd56..e665c1c2e387 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -48,7 +51,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -68,7 +71,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -96,7 +99,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -117,7 +120,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -143,7 +146,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -164,7 +167,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -230,7 +233,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.NotificationCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -251,7 +254,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -267,7 +269,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -321,7 +322,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.NotificationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -344,7 +345,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -359,7 +359,7 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NotificationContract", pipeline_response)
+ deserialized = self._deserialize("NotificationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -394,7 +394,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.NotificationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -418,7 +418,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -433,7 +432,7 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NotificationContract", pipeline_response)
+ deserialized = self._deserialize("NotificationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 d4f0596ab91c..a7f013b1f994 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar, Union
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,16 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -44,7 +47,7 @@ def build_list_by_notification_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -65,7 +68,7 @@ def build_list_by_notification_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -90,7 +93,7 @@ def build_check_entity_exists_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -112,7 +115,7 @@ def build_check_entity_exists_request(
),
"notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
"email": _SERIALIZER.url("email", email, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -137,7 +140,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -159,7 +162,7 @@ def build_create_or_update_request(
),
"notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
"email": _SERIALIZER.url("email", email, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -184,7 +187,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -206,7 +209,7 @@ def build_delete_request(
),
"notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
"email": _SERIALIZER.url("email", email, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -263,7 +266,7 @@ def list_by_notification(
:rtype: ~azure.mgmt.apimanagement.models.RecipientEmailCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -286,7 +289,6 @@ def list_by_notification(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -301,7 +303,7 @@ def list_by_notification(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RecipientEmailCollection", pipeline_response)
+ deserialized = self._deserialize("RecipientEmailCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -335,7 +337,7 @@ def check_entity_exists(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -359,7 +361,6 @@ def check_entity_exists(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -405,7 +406,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.RecipientEmailContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -429,7 +430,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -444,11 +444,7 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("RecipientEmailContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("RecipientEmailContract", pipeline_response)
+ deserialized = self._deserialize("RecipientEmailContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -482,7 +478,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -506,7 +502,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 788581fdc9e5..56f0cb137480 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar, Union
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,16 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -44,7 +47,7 @@ def build_list_by_notification_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -65,7 +68,7 @@ def build_list_by_notification_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -90,7 +93,7 @@ def build_check_entity_exists_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -112,7 +115,7 @@ def build_check_entity_exists_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -137,7 +140,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -159,7 +162,7 @@ def build_create_or_update_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -184,7 +187,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -206,7 +209,7 @@ def build_delete_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -263,7 +266,7 @@ def list_by_notification(
:rtype: ~azure.mgmt.apimanagement.models.RecipientUserCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -286,7 +289,6 @@ def list_by_notification(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -301,7 +303,7 @@ def list_by_notification(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RecipientUserCollection", pipeline_response)
+ deserialized = self._deserialize("RecipientUserCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -336,7 +338,7 @@ def check_entity_exists(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -360,7 +362,6 @@ def check_entity_exists(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -407,7 +408,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.RecipientUserContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -431,7 +432,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -446,11 +446,7 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("RecipientUserContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("RecipientUserContract", pipeline_response)
+ deserialized = self._deserialize("RecipientUserContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -485,7 +481,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -509,7 +505,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 28044167dabb..4637014180b6 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +73,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -96,7 +99,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -117,7 +120,7 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -137,7 +140,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -158,7 +161,7 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -184,7 +187,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -206,7 +209,7 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -230,7 +233,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -252,7 +255,7 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -275,7 +278,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -296,7 +299,7 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -317,7 +320,7 @@ def build_list_secrets_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -338,7 +341,7 @@ def build_list_secrets_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -410,7 +413,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OpenIdConnectProviderCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -432,7 +435,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -448,7 +450,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -493,7 +494,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, opid: str,
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -516,7 +517,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, opid: str,
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -555,7 +555,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -578,7 +578,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -596,7 +595,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response)
+ deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -700,7 +699,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -736,7 +735,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -752,15 +750,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response)
+ deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -865,7 +857,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.OpenidConnectProviderContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -901,7 +893,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -919,7 +910,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response)
+ deserialized = self._deserialize("OpenidConnectProviderContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -946,7 +937,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -970,7 +961,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1005,7 +995,7 @@ def list_secrets(
:rtype: ~azure.mgmt.apimanagement.models.ClientSecretContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1028,7 +1018,6 @@ def list_secrets(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1046,7 +1035,7 @@ def list_secrets(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ClientSecretContract", pipeline_response)
+ deserialized = self._deserialize("ClientSecretContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # 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 ef0d82d8af44..31d4764856f7 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +54,7 @@ def build_list_by_tags_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,7 +75,7 @@ def build_list_by_tags_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -163,7 +166,7 @@ def list_by_tags(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -187,7 +190,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -203,7 +205,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_operation_status_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_operation_status_operations.py
new file mode 100644
index 000000000000..2fff4bd9b971
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_operation_status_operations.py
@@ -0,0 +1,141 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_get_request(location: str, operation_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/operationStatuses/{operationId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "location": _SERIALIZER.url("location", location, "str", min_length=1),
+ "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class OperationStatusOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`operation_status` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.OperationStatusResult:
+ """Returns the current status of an async operation.
+
+ :param location: The name of the Azure region. Required.
+ :type location: str
+ :param operation_id: The ID of an ongoing async operation. Required.
+ :type operation_id: str
+ :return: OperationStatusResult or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationStatusResult
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ location=location,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("OperationStatusResult", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_operations_results_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_operations_results_operations.py
new file mode 100644
index 000000000000..7c8077f13289
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_operations_results_operations.py
@@ -0,0 +1,144 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_get_request(location: str, operation_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/operationResults/{operationId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "location": _SERIALIZER.url("location", location, "str", min_length=1),
+ "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class OperationsResultsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`operations_results` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def get( # pylint: disable=inconsistent-return-statements
+ self, location: str, operation_id: str, **kwargs: Any
+ ) -> None:
+ """Returns operation results for long running operations executing DELETE or PATCH on the
+ resource.
+
+ :param location: The name of the Azure region. Required.
+ :type location: str
+ :param operation_id: The ID of an ongoing async operation. Required.
+ :type operation_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ location=location,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers) # type: ignore
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
index 0bd550934915..74ba00e35735 100644
--- 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,16 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +43,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -49,7 +52,7 @@ def build_list_by_service_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/outboundNetworkDependenciesEndpoints",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -108,7 +111,7 @@ def list_by_service(
:rtype: ~azure.mgmt.apimanagement.models.OutboundEnvironmentEndpointList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -130,7 +133,6 @@ def list_by_service(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -145,7 +147,7 @@ def list_by_service(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OutboundEnvironmentEndpointList", pipeline_response)
+ deserialized = self._deserialize("OutboundEnvironmentEndpointList", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 7fb691c99793..3ce16398237b 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar, Union
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,16 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +48,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -65,7 +68,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -122,7 +125,7 @@ def list_by_service(
:rtype: ~azure.mgmt.apimanagement.models.PolicyDescriptionCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -145,7 +148,6 @@ def list_by_service(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -160,7 +162,7 @@ def list_by_service(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PolicyDescriptionCollection", pipeline_response)
+ deserialized = self._deserialize("PolicyDescriptionCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_fragment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_fragment_operations.py
index c6a8522dfbb5..d639034105f1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_fragment_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_fragment_operations.py
@@ -7,7 +7,9 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,12 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -28,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +58,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +78,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -99,7 +106,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -120,7 +127,7 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -146,7 +153,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -167,7 +174,7 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -195,7 +202,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -217,7 +224,7 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -241,7 +248,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -262,7 +269,7 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -290,7 +297,7 @@ def build_list_references_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -311,7 +318,7 @@ def build_list_references_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -358,7 +365,7 @@ def list_by_service(
top: Optional[int] = None,
skip: Optional[int] = None,
**kwargs: Any
- ) -> _models.PolicyFragmentCollection:
+ ) -> Iterable["_models.PolicyFragmentContract"]:
"""Gets all policy fragments.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -379,57 +386,83 @@ def list_by_service(
:type top: int
:param skip: Number of records to skip. Default value is None.
:type skip: int
- :return: PolicyFragmentCollection or the result of cls(response)
- :rtype: ~azure.mgmt.apimanagement.models.PolicyFragmentCollection
+ :return: An iterator like instance of either PolicyFragmentContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.PolicyFragmentContract]
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
- 401: ClientAuthenticationError,
- 404: ResourceNotFoundError,
- 409: ResourceExistsError,
- 304: ResourceNotModifiedError,
- }
- error_map.update(kwargs.pop("error_map", {}) or {})
-
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PolicyFragmentCollection] = kwargs.pop("cls", None)
- _request = build_list_by_service_request(
- resource_group_name=resource_group_name,
- service_name=service_name,
- subscription_id=self._config.subscription_id,
- filter=filter,
- orderby=orderby,
- top=top,
- skip=skip,
- api_version=api_version,
- headers=_headers,
- params=_params,
- )
- _request = _convert_request(_request)
- _request.url = self._client.format_url(_request.url)
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
- _stream = False
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- _request, stream=_stream, **kwargs
- )
+ 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,
+ orderby=orderby,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyFragmentCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
- response = pipeline_response.http_response
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
- if response.status_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)
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
- deserialized = self._deserialize("PolicyFragmentCollection", pipeline_response)
+ if response.status_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)
- if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return pipeline_response
- return deserialized # type: ignore
+ return ItemPaged(get_next, extract_data)
@distributed_trace
def get_entity_tag(self, resource_group_name: str, service_name: str, id: str, **kwargs: Any) -> bool:
@@ -446,7 +479,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, id: str, *
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -469,7 +502,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, id: str, *
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -516,7 +548,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.PolicyFragmentContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -540,7 +572,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -558,7 +589,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
+ deserialized = self._deserialize("PolicyFragmentContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -573,8 +604,8 @@ def _create_or_update_initial(
parameters: Union[_models.PolicyFragmentContract, IO[bytes]],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.PolicyFragmentContract]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -587,7 +618,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PolicyFragmentContract]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -610,35 +641,33 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
response_headers = {}
- if response.status_code == 200:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
-
- deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
-
- deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- if response.status_code == 202:
- response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -768,14 +797,19 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
+ deserialized = self._deserialize("PolicyFragmentContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
@@ -819,7 +853,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -843,7 +877,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -888,7 +921,7 @@ def list_references(
:rtype: ~azure.mgmt.apimanagement.models.ResourceCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -913,7 +946,6 @@ def list_references(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -928,7 +960,7 @@ def list_references(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ResourceCollection", pipeline_response)
+ deserialized = self._deserialize("ResourceCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 13fe9cf1df30..3193efda324b 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
@@ -7,7 +7,9 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,17 +19,20 @@
ResourceNotModifiedError,
map_error,
)
+from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -41,7 +46,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -61,7 +66,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -85,7 +90,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -106,7 +111,7 @@ def build_get_entity_tag_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -132,7 +137,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -153,7 +158,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -181,7 +186,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -203,7 +208,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -233,7 +238,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -254,7 +259,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -289,7 +294,9 @@ def __init__(self, *args, **kwargs):
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
- def list_by_service(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.PolicyCollection:
+ def list_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> Iterable["_models.PolicyContract"]:
"""Lists all the Global Policy definitions of the Api Management service.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -297,53 +304,78 @@ def list_by_service(self, resource_group_name: str, service_name: str, **kwargs:
:type resource_group_name: str
:param service_name: The name of the API Management service. Required.
:type service_name: str
- :return: PolicyCollection or the result of cls(response)
- :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection
+ :return: An iterator like instance of either PolicyContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.PolicyContract]
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
- 401: ClientAuthenticationError,
- 404: ResourceNotFoundError,
- 409: ResourceExistsError,
- 304: ResourceNotModifiedError,
- }
- error_map.update(kwargs.pop("error_map", {}) or {})
-
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None)
- _request = build_list_by_service_request(
- resource_group_name=resource_group_name,
- service_name=service_name,
- subscription_id=self._config.subscription_id,
- api_version=api_version,
- headers=_headers,
- params=_params,
- )
- _request = _convert_request(_request)
- _request.url = self._client.format_url(_request.url)
-
- _stream = False
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- _request, stream=_stream, **kwargs
- )
-
- response = pipeline_response.http_response
-
- if response.status_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("PolicyCollection", pipeline_response)
-
- if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
- return deserialized # type: ignore
+ 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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
@distributed_trace
def get_entity_tag(
@@ -363,7 +395,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -386,7 +418,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -433,7 +464,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -457,7 +488,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -475,7 +505,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -579,7 +609,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -615,7 +645,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -631,15 +660,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -671,7 +694,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -695,7 +718,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_restriction_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_restriction_operations.py
new file mode 100644
index 000000000000..2ce3bb52756e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_restriction_operations.py
@@ -0,0 +1,935 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, policy_restriction_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "policyRestrictionId": _SERIALIZER.url(
+ "policy_restriction_id", policy_restriction_id, "str", max_length=80, min_length=1
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, policy_restriction_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "policyRestrictionId": _SERIALIZER.url(
+ "policy_restriction_id", policy_restriction_id, "str", max_length=80, min_length=1
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "policyRestrictionId": _SERIALIZER.url(
+ "policy_restriction_id", policy_restriction_id, "str", max_length=80, min_length=1
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "policyRestrictionId": _SERIALIZER.url(
+ "policy_restriction_id", policy_restriction_id, "str", max_length=80, min_length=1
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions/{policyRestrictionId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "policyRestrictionId": _SERIALIZER.url(
+ "policy_restriction_id", policy_restriction_id, "str", max_length=80, min_length=1
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class PolicyRestrictionOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`policy_restriction` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> Iterable["_models.PolicyRestrictionContract"]:
+ """Gets all policy restrictions of API Management services.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :return: An iterator like instance of either PolicyRestrictionContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.PolicyRestrictionContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyRestrictionCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyRestrictionCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, policy_restriction_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the policy restriction in the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, policy_restriction_id: str, **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Get the policy restriction of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyRestrictionContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyRestrictionContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ parameters: _models.PolicyRestrictionContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Creates or updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Creates or updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ parameters: Union[_models.PolicyRestrictionContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Creates or updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param parameters: The policy restriction to apply. Is either a PolicyRestrictionContract type
+ or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.PolicyRestrictionContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyRestrictionContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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("PolicyRestrictionContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: str,
+ parameters: _models.PolicyRestrictionUpdateContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_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. Required.
+ :type if_match: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionUpdateContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_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. Required.
+ :type if_match: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: str,
+ parameters: Union[_models.PolicyRestrictionUpdateContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_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. Required.
+ :type if_match: str
+ :param parameters: The policy restriction to apply. Is either a PolicyRestrictionUpdateContract
+ type or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionUpdateContract or IO[bytes]
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.PolicyRestrictionContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyRestrictionUpdateContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyRestrictionContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the policy restriction configuration of the Api Management Service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_restriction_validations_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_restriction_validations_operations.py
new file mode 100644
index 000000000000..d85b33845373
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_restriction_validations_operations.py
@@ -0,0 +1,216 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Iterator, Optional, Type, TypeVar, Union, cast
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.arm_polling import ARMPolling
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_by_service_request(
+ resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/validatePolicies",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class PolicyRestrictionValidationsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`policy_restriction_validations` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ def _by_service_initial(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ _request = build_by_service_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def begin_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> LROPoller[_models.OperationResultContract]:
+ """Validate all policies of API Management services.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :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:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.OperationResultContract] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._by_service_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ deserialized = self._deserialize("OperationResultContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: PollingMethod = cast(
+ PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[_models.OperationResultContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[_models.OperationResultContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_config_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_config_operations.py
index f0f8123bec04..279cfa362b3f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_config_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_config_operations.py
@@ -7,7 +7,9 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,17 +19,20 @@
ResourceNotModifiedError,
map_error,
)
+from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -41,7 +46,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -61,7 +66,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -81,7 +86,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -90,7 +95,7 @@ def build_get_entity_tag_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -122,7 +127,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -131,7 +136,7 @@ def build_get_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -169,7 +174,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -179,7 +184,7 @@ def build_update_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -220,7 +225,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -230,7 +235,7 @@ def build_create_or_update_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -281,7 +286,7 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list_by_service(
self, resource_group_name: str, service_name: str, **kwargs: Any
- ) -> _models.PortalConfigCollection:
+ ) -> Iterable["_models.PortalConfigContract"]:
"""Lists the developer portal configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -289,53 +294,79 @@ def list_by_service(
:type resource_group_name: str
:param service_name: The name of the API Management service. Required.
:type service_name: str
- :return: PortalConfigCollection or the result of cls(response)
- :rtype: ~azure.mgmt.apimanagement.models.PortalConfigCollection
+ :return: An iterator like instance of either PortalConfigContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.PortalConfigContract]
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
- 401: ClientAuthenticationError,
- 404: ResourceNotFoundError,
- 409: ResourceExistsError,
- 304: ResourceNotModifiedError,
- }
- error_map.update(kwargs.pop("error_map", {}) or {})
-
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PortalConfigCollection] = kwargs.pop("cls", None)
- _request = build_list_by_service_request(
- resource_group_name=resource_group_name,
- service_name=service_name,
- subscription_id=self._config.subscription_id,
- api_version=api_version,
- headers=_headers,
- params=_params,
- )
- _request = _convert_request(_request)
- _request.url = self._client.format_url(_request.url)
-
- _stream = False
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- _request, stream=_stream, **kwargs
- )
-
- response = pipeline_response.http_response
-
- if response.status_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("PortalConfigCollection", pipeline_response)
-
- if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
- return deserialized # type: ignore
+ 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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("PortalConfigCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
@distributed_trace
def get_entity_tag(self, resource_group_name: str, service_name: str, portal_config_id: str, **kwargs: Any) -> bool:
@@ -352,7 +383,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, portal_con
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -375,7 +406,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, portal_con
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -414,7 +444,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -437,7 +467,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -455,7 +484,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PortalConfigContract", pipeline_response)
+ deserialized = self._deserialize("PortalConfigContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -559,7 +588,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -595,7 +624,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -610,7 +638,7 @@ def update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PortalConfigContract", pipeline_response)
+ deserialized = self._deserialize("PortalConfigContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -714,7 +742,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PortalConfigContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -750,7 +778,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -765,7 +792,7 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PortalConfigContract", pipeline_response)
+ deserialized = self._deserialize("PortalConfigContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 321c745a9057..2344f6799e5e 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -52,7 +57,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,7 +77,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -98,7 +103,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -121,7 +126,7 @@ def build_get_entity_tag_request(
"portalRevisionId": _SERIALIZER.url(
"portal_revision_id", portal_revision_id, "str", max_length=256, min_length=1
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -141,7 +146,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -164,7 +169,7 @@ def build_get_request(
"portalRevisionId": _SERIALIZER.url(
"portal_revision_id", portal_revision_id, "str", max_length=256, min_length=1
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -184,7 +189,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -208,7 +213,7 @@ def build_create_or_update_request(
"portalRevisionId": _SERIALIZER.url(
"portal_revision_id", portal_revision_id, "str", max_length=256, min_length=1
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -236,7 +241,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -260,7 +265,7 @@ def build_update_request(
"portalRevisionId": _SERIALIZER.url(
"portal_revision_id", portal_revision_id, "str", max_length=256, min_length=1
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -341,7 +346,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PortalRevisionCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -363,7 +368,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -379,7 +383,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -427,7 +430,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -450,7 +453,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -490,7 +492,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.PortalRevisionContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -513,7 +515,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -531,7 +532,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ deserialized = self._deserialize("PortalRevisionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -545,8 +546,8 @@ def _create_or_update_initial(
portal_revision_id: str,
parameters: Union[_models.PortalRevisionContract, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.PortalRevisionContract]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -559,7 +560,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PortalRevisionContract]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -581,27 +582,33 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [201, 202]:
+ if response.status_code not in [201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
response_headers = {}
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -723,14 +730,19 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ deserialized = self._deserialize("PortalRevisionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
@@ -762,8 +774,8 @@ def _update_initial(
if_match: str,
parameters: Union[_models.PortalRevisionContract, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.PortalRevisionContract]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -776,7 +788,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PortalRevisionContract]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -799,10 +811,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -810,16 +822,25 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = 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 response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -951,6 +972,7 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
@@ -958,7 +980,7 @@ def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ deserialized = self._deserialize("PortalRevisionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
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 7dfe53efa777..a90756e5b8ac 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,16 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +43,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -60,7 +63,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -108,7 +111,7 @@ def list_by_service(
:rtype: ~azure.mgmt.apimanagement.models.PortalSettingsCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -130,7 +133,6 @@ def list_by_service(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -145,7 +147,7 @@ def list_by_service(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PortalSettingsCollection", pipeline_response)
+ deserialized = self._deserialize("PortalSettingsCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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
index 7fe3dfb4b125..6f4f656b28f7 100644
--- 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +50,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -54,7 +59,7 @@ def build_list_by_service_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -89,7 +94,7 @@ def build_get_by_name_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -112,7 +117,7 @@ def build_get_by_name_request(
"privateEndpointConnectionName": _SERIALIZER.url(
"private_endpoint_connection_name", private_endpoint_connection_name, "str"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -136,7 +141,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -160,7 +165,7 @@ def build_create_or_update_request(
"privateEndpointConnectionName": _SERIALIZER.url(
"private_endpoint_connection_name", private_endpoint_connection_name, "str"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -186,7 +191,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -209,7 +214,7 @@ def build_delete_request(
"privateEndpointConnectionName": _SERIALIZER.url(
"private_endpoint_connection_name", private_endpoint_connection_name, "str"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -229,7 +234,7 @@ def build_list_private_link_resources_request( # pylint: disable=name-too-long
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -241,7 +246,7 @@ def build_list_private_link_resources_request( # pylint: disable=name-too-long
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"serviceName": _SERIALIZER.url(
"service_name",
service_name,
@@ -273,7 +278,7 @@ def build_get_private_link_resource_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -285,7 +290,7 @@ def build_get_private_link_resource_request(
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"serviceName": _SERIALIZER.url(
"service_name",
service_name,
@@ -352,7 +357,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -371,7 +376,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -387,7 +391,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -434,7 +437,7 @@ def get_by_name(
:rtype: ~azure.mgmt.apimanagement.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -457,7 +460,6 @@ def get_by_name(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -472,7 +474,7 @@ def get_by_name(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -486,8 +488,8 @@ def _create_or_update_initial(
private_endpoint_connection_name: str,
private_endpoint_connection_request: Union[_models.PrivateEndpointConnectionRequest, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.PrivateEndpointConnection]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -500,7 +502,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -522,10 +524,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -533,16 +535,22 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
- if response.status_code == 200:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@@ -661,10 +669,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -686,10 +695,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, service_name: str, private_endpoint_connection_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -701,7 +710,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -712,10 +721,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -723,12 +732,24 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -756,7 +777,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
service_name=service_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -766,6 +787,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -802,7 +824,7 @@ def list_private_link_resources(
:rtype: ~azure.mgmt.apimanagement.models.PrivateLinkResourceListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -824,7 +846,6 @@ def list_private_link_resources(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -839,7 +860,7 @@ def list_private_link_resources(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -863,7 +884,7 @@ def get_private_link_resource(
:rtype: ~azure.mgmt.apimanagement.models.PrivateLinkResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -886,7 +907,6 @@ def get_private_link_resource(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -901,7 +921,7 @@ def get_private_link_resource(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResource", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_api_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_api_link_operations.py
new file mode 100644
index 000000000000..7b26ca2970f8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_api_link_operations.py
@@ -0,0 +1,646 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_product_request(
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, product_id: str, api_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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),
+ "apiLinkId": _SERIALIZER.url(
+ "api_link_id", api_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str, service_name: str, product_id: str, api_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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),
+ "apiLinkId": _SERIALIZER.url(
+ "api_link_id", api_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str, service_name: str, product_id: str, api_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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),
+ "apiLinkId": _SERIALIZER.url(
+ "api_link_id", api_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class ProductApiLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`product_api_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ProductApiLinkContract"]:
+ """Lists a collection of the API links associated with a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either ProductApiLinkContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ProductApiLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductApiLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ProductApiLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, product_id: str, api_link_id: str, **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Gets the API link for the product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductApiLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ProductApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ api_link_id: str,
+ parameters: _models.ProductApiLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Adds an API to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ api_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Adds an API to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ api_link_id: str,
+ parameters: Union[_models.ProductApiLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Adds an API to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Is either a ProductApiLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductApiLinkContract or IO[bytes]
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ProductApiLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductApiLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, product_id: str, api_link_id: str, **kwargs: Any
+ ) -> None:
+ """Deletes the specified API from the specified product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # 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 98cab51788f2..105ba4514eb9 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_product_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +74,7 @@ def build_list_by_product_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -97,7 +100,7 @@ def build_check_entity_exists_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,7 +122,7 @@ def build_check_entity_exists_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -139,7 +142,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -161,7 +164,7 @@ def build_create_or_update_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -181,7 +184,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -203,7 +206,7 @@ def build_delete_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -280,7 +283,7 @@ def list_by_product(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -303,7 +306,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -319,7 +321,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -370,7 +371,7 @@ def check_entity_exists(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -394,7 +395,6 @@ def check_entity_exists(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -434,7 +434,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ApiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -458,7 +458,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -473,11 +472,7 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("ApiContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ApiContract", pipeline_response)
+ deserialized = self._deserialize("ApiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -505,7 +500,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -529,7 +524,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_group_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_group_link_operations.py
new file mode 100644
index 000000000000..2680e3ddba49
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_group_link_operations.py
@@ -0,0 +1,661 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_product_request(
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ group_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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),
+ "groupLinkId": _SERIALIZER.url(
+ "group_link_id", group_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ group_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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),
+ "groupLinkId": _SERIALIZER.url(
+ "group_link_id", group_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ group_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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),
+ "groupLinkId": _SERIALIZER.url(
+ "group_link_id", group_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class ProductGroupLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`product_group_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ProductGroupLinkContract"]:
+ """Lists a collection of the group links associated with a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| groupId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either ProductGroupLinkContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ProductGroupLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductGroupLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ProductGroupLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, product_id: str, group_link_id: str, **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Gets the group link for the product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductGroupLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ProductGroupLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ group_link_id: str,
+ parameters: _models.ProductGroupLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Adds a group to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ group_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Adds a group to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ group_link_id: str,
+ parameters: Union[_models.ProductGroupLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Adds a group to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :param parameters: Create or update parameters. Is either a ProductGroupLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract or IO[bytes]
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ProductGroupLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductGroupLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, product_id: str, group_link_id: str, **kwargs: Any
+ ) -> None:
+ """Deletes the specified group from the specified product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # 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 28c8cbc846eb..84245b043c01 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_product_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +74,7 @@ def build_list_by_product_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -97,7 +100,7 @@ def build_check_entity_exists_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,7 +122,7 @@ def build_check_entity_exists_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -139,7 +142,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -161,7 +164,7 @@ def build_create_or_update_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -181,7 +184,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -203,7 +206,7 @@ def build_delete_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -276,7 +279,7 @@ def list_by_product(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GroupCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -299,7 +302,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -315,7 +317,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -366,7 +367,7 @@ def check_entity_exists(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -390,7 +391,6 @@ def check_entity_exists(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -430,7 +430,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.GroupContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -454,7 +454,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -469,11 +468,7 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("GroupContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("GroupContract", pipeline_response)
+ deserialized = self._deserialize("GroupContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -501,7 +496,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -525,7 +520,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 707b8a0fbb52..6ff97a5e0070 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -52,7 +55,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,7 +75,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -102,7 +105,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -123,7 +126,7 @@ def build_get_entity_tag_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -143,7 +146,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -164,7 +167,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -190,7 +193,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -212,7 +215,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -236,7 +239,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -258,7 +261,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -288,7 +291,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -309,7 +312,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -340,7 +343,7 @@ def build_list_by_tags_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -360,7 +363,7 @@ def build_list_by_tags_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -450,7 +453,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ProductCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -474,7 +477,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -490,7 +492,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -536,7 +537,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, product_id
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -559,7 +560,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, product_id
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -599,7 +599,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.ProductContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -622,7 +622,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -640,7 +639,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ProductContract", pipeline_response)
+ deserialized = self._deserialize("ProductContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -747,7 +746,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.ProductContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -783,7 +782,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -799,15 +797,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ProductContract", pipeline_response)
+ deserialized = self._deserialize("ProductContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -914,7 +906,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.ProductContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -950,7 +942,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -968,7 +959,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("ProductContract", pipeline_response)
+ deserialized = self._deserialize("ProductContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1005,7 +996,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1030,7 +1021,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1091,7 +1081,7 @@ def list_by_tags(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1114,7 +1104,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1130,7 +1119,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 88a95cbe6947..c199e4d3e355 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
@@ -7,7 +7,9 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,17 +19,20 @@
ResourceNotModifiedError,
map_error,
)
+from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -41,7 +46,7 @@ def build_list_by_product_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,7 +67,7 @@ def build_list_by_product_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -87,7 +92,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -109,7 +114,7 @@ def build_get_entity_tag_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -136,7 +141,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -158,7 +163,7 @@ def build_get_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -187,7 +192,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -210,7 +215,7 @@ def build_create_or_update_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -241,7 +246,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -263,7 +268,7 @@ def build_delete_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -300,7 +305,7 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list_by_product(
self, resource_group_name: str, service_name: str, product_id: str, **kwargs: Any
- ) -> _models.PolicyCollection:
+ ) -> Iterable["_models.PolicyContract"]:
"""Get the policy configuration at the Product level.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -311,54 +316,79 @@ def list_by_product(
:param product_id: Product identifier. Must be unique in the current API Management service
instance. Required.
:type product_id: str
- :return: PolicyCollection or the result of cls(response)
- :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection
+ :return: An iterator like instance of either PolicyContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.PolicyContract]
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
- 401: ClientAuthenticationError,
- 404: ResourceNotFoundError,
- 409: ResourceExistsError,
- 304: ResourceNotModifiedError,
- }
- error_map.update(kwargs.pop("error_map", {}) or {})
-
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None)
- _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,
- api_version=api_version,
- headers=_headers,
- params=_params,
- )
- _request = _convert_request(_request)
- _request.url = self._client.format_url(_request.url)
-
- _stream = False
- pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- _request, stream=_stream, **kwargs
- )
-
- response = pipeline_response.http_response
-
- if response.status_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("PolicyCollection", pipeline_response)
-
- if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
- return deserialized # type: ignore
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
@distributed_trace
def get_entity_tag(
@@ -385,7 +415,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -409,7 +439,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -460,7 +489,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -485,7 +514,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -503,7 +531,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -619,7 +647,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PolicyContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -656,7 +684,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -672,15 +699,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PolicyContract", pipeline_response)
+ deserialized = self._deserialize("PolicyContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -716,7 +737,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -741,7 +762,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 9f8299e83d9b..3a37e04e22bc 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +74,7 @@ def build_list_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -158,7 +161,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SubscriptionCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -181,7 +184,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -197,7 +199,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wiki_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wiki_operations.py
index 2ea47a95f4a8..dde4674899fb 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wiki_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wiki_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -41,7 +44,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,7 +65,7 @@ def build_get_entity_tag_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -82,7 +85,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -103,7 +106,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -129,7 +132,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -151,7 +154,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -175,7 +178,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -197,7 +200,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -220,7 +223,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -241,7 +244,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -291,7 +294,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, product_id
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -314,7 +317,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, product_id
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -352,7 +354,7 @@ def get(self, resource_group_name: str, service_name: str, product_id: str, **kw
:rtype: ~azure.mgmt.apimanagement.models.WikiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -375,7 +377,6 @@ def get(self, resource_group_name: str, service_name: str, product_id: str, **kw
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -393,7 +394,7 @@ def get(self, resource_group_name: str, service_name: str, product_id: str, **kw
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("WikiContract", pipeline_response)
+ deserialized = self._deserialize("WikiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -500,7 +501,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.WikiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -536,7 +537,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -552,15 +552,9 @@ def create_or_update(
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("WikiContract", pipeline_response)
-
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("WikiContract", pipeline_response)
+ deserialized = self._deserialize("WikiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -667,7 +661,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.WikiContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -703,7 +697,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -721,7 +714,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("WikiContract", pipeline_response)
+ deserialized = self._deserialize("WikiContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -749,7 +742,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -773,7 +766,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wikis_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wikis_operations.py
index 595ebc2753af..e52d082dc43c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wikis_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_wikis_operations.py
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +74,7 @@ def build_list_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -149,7 +152,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WikiCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -172,7 +175,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -188,7 +190,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 6db23c2bcfcb..6bf6acd7b6a3 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -41,7 +44,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,7 +65,7 @@ def build_list_by_service_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -82,7 +85,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -104,7 +107,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -164,7 +167,7 @@ def list_by_service(
:rtype: ~azure.mgmt.apimanagement.models.QuotaCounterCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -187,7 +190,6 @@ def list_by_service(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -202,7 +204,7 @@ def list_by_service(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("QuotaCounterCollection", pipeline_response)
+ deserialized = self._deserialize("QuotaCounterCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -308,7 +310,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.QuotaCounterCollection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -343,7 +345,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -358,7 +359,7 @@ def update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("QuotaCounterCollection", pipeline_response)
+ deserialized = self._deserialize("QuotaCounterCollection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 dbbb07428dda..e6ccc9370bc9 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -46,7 +49,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -68,7 +71,7 @@ def build_get_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -93,7 +96,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -116,7 +119,7 @@ def build_update_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -178,7 +181,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.QuotaCounterContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -202,7 +205,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -217,7 +219,7 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("QuotaCounterContract", pipeline_response)
+ deserialized = self._deserialize("QuotaCounterContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -329,7 +331,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.QuotaCounterContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -365,7 +367,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -380,7 +381,7 @@ def update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("QuotaCounterContract", pipeline_response)
+ deserialized = self._deserialize("QuotaCounterContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 66a99f7cc09e..09fd86744c9b 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -42,7 +45,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,7 +65,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -116,7 +119,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.RegionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -135,7 +138,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -151,7 +153,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 74b98b9f016e..4357fc8f70c9 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import datetime
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +54,7 @@ def build_list_by_api_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +74,7 @@ def build_list_by_api_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -106,7 +109,7 @@ def build_list_by_user_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -126,7 +129,7 @@ def build_list_by_user_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -161,7 +164,7 @@ def build_list_by_operation_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -181,7 +184,7 @@ def build_list_by_operation_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -216,7 +219,7 @@ def build_list_by_product_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -236,7 +239,7 @@ def build_list_by_product_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -270,7 +273,7 @@ def build_list_by_geo_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -290,7 +293,7 @@ def build_list_by_geo_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -323,7 +326,7 @@ def build_list_by_subscription_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -343,7 +346,7 @@ def build_list_by_subscription_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -379,7 +382,7 @@ def build_list_by_time_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -399,7 +402,7 @@ def build_list_by_time_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -434,7 +437,7 @@ def build_list_by_request_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -454,7 +457,7 @@ def build_list_by_request_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -529,7 +532,7 @@ def list_by_api(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -552,7 +555,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -568,7 +570,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -648,7 +649,7 @@ def list_by_user(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -671,7 +672,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -687,7 +687,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -767,7 +766,7 @@ def list_by_operation(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -790,7 +789,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -806,7 +804,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -885,7 +882,7 @@ def list_by_product(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -908,7 +905,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -924,7 +920,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1000,7 +995,7 @@ def list_by_geo(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1022,7 +1017,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1038,7 +1032,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1117,7 +1110,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1140,7 +1133,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1156,7 +1148,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1240,7 +1231,7 @@ def list_by_time(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1264,7 +1255,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1280,7 +1270,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1349,7 +1338,7 @@ def list_by_request(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.RequestReportCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1371,7 +1360,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1387,7 +1375,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 1cd6b13fdbef..5ac41d73dd78 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -41,7 +44,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -61,7 +64,7 @@ def build_get_entity_tag_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -79,7 +82,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -99,7 +102,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -119,7 +122,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -140,7 +143,7 @@ def build_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -163,7 +166,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -184,7 +187,7 @@ def build_create_or_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -234,7 +237,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -256,7 +259,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -291,7 +293,7 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo
:rtype: ~azure.mgmt.apimanagement.models.PortalSigninSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -313,7 +315,6 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -331,7 +332,7 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PortalSigninSettings", pipeline_response)
+ deserialized = self._deserialize("PortalSigninSettings", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -426,7 +427,7 @@ def update( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -461,7 +462,6 @@ def update( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -567,7 +567,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PortalSigninSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -602,7 +602,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -617,7 +616,7 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PortalSigninSettings", pipeline_response)
+ deserialized = self._deserialize("PortalSigninSettings", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 9fb857691410..70778641c230 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -41,7 +44,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -61,7 +64,7 @@ def build_get_entity_tag_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -79,7 +82,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -99,7 +102,7 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -119,7 +122,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -140,7 +143,7 @@ def build_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -163,7 +166,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -184,7 +187,7 @@ def build_create_or_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -234,7 +237,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -256,7 +259,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, **kwargs:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -291,7 +293,7 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo
:rtype: ~azure.mgmt.apimanagement.models.PortalSignupSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -313,7 +315,6 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -331,7 +332,7 @@ def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _mo
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("PortalSignupSettings", pipeline_response)
+ deserialized = self._deserialize("PortalSignupSettings", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -426,7 +427,7 @@ def update( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -461,7 +462,6 @@ def update( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -567,7 +567,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.PortalSignupSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -602,7 +602,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -617,7 +616,7 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PortalSignupSettings", pipeline_response)
+ deserialized = self._deserialize("PortalSignupSettings", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 bbc5dd3f0737..31ccf2d5d20d 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +73,7 @@ def build_list_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -96,7 +99,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -117,7 +120,7 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -137,7 +140,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -158,7 +161,7 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -186,7 +189,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -208,7 +211,7 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -244,7 +247,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -266,7 +269,7 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -293,7 +296,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -314,7 +317,7 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -335,7 +338,7 @@ def build_regenerate_primary_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -356,7 +359,7 @@ def build_regenerate_primary_key_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -376,7 +379,7 @@ def build_regenerate_secondary_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -397,7 +400,7 @@ def build_regenerate_secondary_key_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -417,7 +420,7 @@ def build_list_secrets_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -438,7 +441,7 @@ def build_list_secrets_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -515,7 +518,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SubscriptionCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -537,7 +540,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -553,7 +555,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -600,7 +601,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, sid: str,
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -623,7 +624,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, sid: str,
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -661,7 +661,7 @@ def get(self, resource_group_name: str, service_name: str, sid: str, **kwargs: A
:rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -684,7 +684,6 @@ def get(self, resource_group_name: str, service_name: str, sid: str, **kwargs: A
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -702,7 +701,7 @@ def get(self, resource_group_name: str, service_name: str, sid: str, **kwargs: A
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -845,7 +844,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -883,7 +882,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -899,15 +897,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1050,7 +1042,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1088,7 +1080,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1106,7 +1097,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1134,7 +1125,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1158,7 +1149,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1194,7 +1184,7 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1217,7 +1207,6 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1253,7 +1242,7 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1276,7 +1265,6 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1312,7 +1300,7 @@ def list_secrets(
:rtype: ~azure.mgmt.apimanagement.models.SubscriptionKeysContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1335,7 +1323,6 @@ def list_secrets(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1353,7 +1340,7 @@ def list_secrets(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("SubscriptionKeysContract", pipeline_response)
+ deserialized = self._deserialize("SubscriptionKeysContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_api_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_api_link_operations.py
new file mode 100644
index 000000000000..c54252a40401
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_api_link_operations.py
@@ -0,0 +1,645 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_product_request(
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, tag_id: str, api_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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"^[^*#&+:<>?]+$"),
+ "apiLinkId": _SERIALIZER.url(
+ "api_link_id", api_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str, service_name: str, tag_id: str, api_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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"^[^*#&+:<>?]+$"),
+ "apiLinkId": _SERIALIZER.url(
+ "api_link_id", api_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str, service_name: str, tag_id: str, api_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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"^[^*#&+:<>?]+$"),
+ "apiLinkId": _SERIALIZER.url(
+ "api_link_id", api_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class TagApiLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`tag_api_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.TagApiLinkContract"]:
+ """Lists a collection of the API links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagApiLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagApiLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagApiLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, tag_id: str, api_link_id: str, **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Gets the API link for the tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagApiLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ api_link_id: str,
+ parameters: _models.TagApiLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Adds an API to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ api_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Adds an API to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ api_link_id: str,
+ parameters: Union[_models.TagApiLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Adds an API to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Is either a TagApiLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagApiLinkContract or IO[bytes]
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagApiLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagApiLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, tag_id: str, api_link_id: str, **kwargs: Any
+ ) -> None:
+ """Deletes the specified API from the specified tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_operation_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_operation_link_operations.py
new file mode 100644
index 000000000000..2ad0818be472
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_operation_link_operations.py
@@ -0,0 +1,661 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_product_request(
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ operation_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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"^[^*#&+:<>?]+$"),
+ "operationLinkId": _SERIALIZER.url(
+ "operation_link_id", operation_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ operation_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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"^[^*#&+:<>?]+$"),
+ "operationLinkId": _SERIALIZER.url(
+ "operation_link_id", operation_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ operation_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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"^[^*#&+:<>?]+$"),
+ "operationLinkId": _SERIALIZER.url(
+ "operation_link_id", operation_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class TagOperationLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`tag_operation_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.TagOperationLinkContract"]:
+ """Lists a collection of the operation links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| operationId
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either TagOperationLinkContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagOperationLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagOperationLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagOperationLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, tag_id: str, operation_link_id: str, **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Gets the operation link for the tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagOperationLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagOperationLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ operation_link_id: str,
+ parameters: _models.TagOperationLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Adds an operation to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ operation_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Adds an operation to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ operation_link_id: str,
+ parameters: Union[_models.TagOperationLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Adds an operation to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :param parameters: Create or update parameters. Is either a TagOperationLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagOperationLinkContract or IO[bytes]
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagOperationLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagOperationLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, tag_id: str, operation_link_id: str, **kwargs: Any
+ ) -> None:
+ """Deletes the specified operation from the specified tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # 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 87c761434a1d..2e97d5ec0302 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -52,7 +55,7 @@ def build_list_by_operation_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -74,7 +77,7 @@ def build_list_by_operation_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -106,7 +109,7 @@ def build_get_entity_state_by_operation_request( # pylint: disable=name-too-lon
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -129,7 +132,7 @@ def build_get_entity_state_by_operation_request( # pylint: disable=name-too-lon
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -155,7 +158,7 @@ def build_get_by_operation_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -178,7 +181,7 @@ def build_get_by_operation_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -204,7 +207,7 @@ def build_assign_to_operation_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -227,7 +230,7 @@ def build_assign_to_operation_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -253,7 +256,7 @@ def build_detach_from_operation_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -276,7 +279,7 @@ def build_detach_from_operation_request(
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -304,7 +307,7 @@ def build_list_by_api_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -325,7 +328,7 @@ def build_list_by_api_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -351,7 +354,7 @@ def build_get_entity_state_by_api_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -373,7 +376,7 @@ def build_get_entity_state_by_api_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -393,7 +396,7 @@ def build_get_by_api_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -415,7 +418,7 @@ def build_get_by_api_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -435,7 +438,7 @@ def build_assign_to_api_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -457,7 +460,7 @@ def build_assign_to_api_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -477,7 +480,7 @@ def build_detach_from_api_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -499,7 +502,7 @@ def build_detach_from_api_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -527,7 +530,7 @@ def build_list_by_product_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -548,7 +551,7 @@ def build_list_by_product_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -574,7 +577,7 @@ def build_get_entity_state_by_product_request( # pylint: disable=name-too-long
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -596,7 +599,7 @@ def build_get_entity_state_by_product_request( # pylint: disable=name-too-long
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -616,7 +619,7 @@ def build_get_by_product_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -638,7 +641,7 @@ def build_get_by_product_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -658,7 +661,7 @@ def build_assign_to_product_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -680,7 +683,7 @@ def build_assign_to_product_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -700,7 +703,7 @@ def build_detach_from_product_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -722,7 +725,7 @@ def build_detach_from_product_request(
),
"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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -750,7 +753,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -770,7 +773,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -798,7 +801,7 @@ def build_get_entity_state_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -819,7 +822,7 @@ def build_get_entity_state_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -839,7 +842,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -860,7 +863,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -886,7 +889,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -908,7 +911,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -932,7 +935,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -954,7 +957,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -977,7 +980,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -998,7 +1001,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -1077,7 +1080,7 @@ def list_by_operation(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1101,7 +1104,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1117,7 +1119,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1171,7 +1172,7 @@ def get_entity_state_by_operation(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1196,7 +1197,6 @@ def get_entity_state_by_operation(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1242,7 +1242,7 @@ def get_by_operation(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1267,7 +1267,6 @@ def get_by_operation(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1285,7 +1284,7 @@ def get_by_operation(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1316,7 +1315,7 @@ def assign_to_operation(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1341,7 +1340,6 @@ def assign_to_operation(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1356,11 +1354,7 @@ def assign_to_operation(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("TagContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1391,7 +1385,7 @@ def detach_from_operation( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1416,7 +1410,6 @@ def detach_from_operation( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1475,7 +1468,7 @@ def list_by_api(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1498,7 +1491,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1514,7 +1506,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1565,7 +1556,7 @@ def get_entity_state_by_api(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1589,7 +1580,6 @@ def get_entity_state_by_api(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1632,7 +1622,7 @@ def get_by_api(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1656,7 +1646,6 @@ def get_by_api(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1674,7 +1663,7 @@ def get_by_api(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1702,7 +1691,7 @@ def assign_to_api(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1726,7 +1715,6 @@ def assign_to_api(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1742,15 +1730,9 @@ def assign_to_api(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1778,7 +1760,7 @@ def detach_from_api( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1802,7 +1784,6 @@ def detach_from_api( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1861,7 +1842,7 @@ def list_by_product(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1884,7 +1865,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1900,7 +1880,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1951,7 +1930,7 @@ def get_entity_state_by_product(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1975,7 +1954,6 @@ def get_entity_state_by_product(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -2018,7 +1996,7 @@ def get_by_product(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2042,7 +2020,6 @@ def get_by_product(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -2060,7 +2037,7 @@ def get_by_product(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -2088,7 +2065,7 @@ def assign_to_product(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2112,7 +2089,6 @@ def assign_to_product(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -2127,11 +2103,7 @@ def assign_to_product(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("TagContract", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -2159,7 +2131,7 @@ def detach_from_product( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2183,7 +2155,6 @@ def detach_from_product( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -2241,7 +2212,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2264,7 +2235,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -2280,7 +2250,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -2326,7 +2295,7 @@ def get_entity_state(self, resource_group_name: str, service_name: str, tag_id:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2349,7 +2318,6 @@ def get_entity_state(self, resource_group_name: str, service_name: str, tag_id:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -2387,7 +2355,7 @@ def get(self, resource_group_name: str, service_name: str, tag_id: str, **kwargs
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2410,7 +2378,6 @@ def get(self, resource_group_name: str, service_name: str, tag_id: str, **kwargs
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -2428,7 +2395,7 @@ def get(self, resource_group_name: str, service_name: str, tag_id: str, **kwargs
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -2535,7 +2502,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2571,7 +2538,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -2587,15 +2553,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -2702,7 +2662,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.TagContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2738,7 +2698,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -2756,7 +2715,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TagContract", pipeline_response)
+ deserialized = self._deserialize("TagContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -2784,7 +2743,7 @@ def delete( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2808,7 +2767,6 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_product_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_product_link_operations.py
new file mode 100644
index 000000000000..55b93fefc782
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_product_link_operations.py
@@ -0,0 +1,646 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_product_request(
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, tag_id: str, product_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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"^[^*#&+:<>?]+$"),
+ "productLinkId": _SERIALIZER.url(
+ "product_link_id", product_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str, service_name: str, tag_id: str, product_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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"^[^*#&+:<>?]+$"),
+ "productLinkId": _SERIALIZER.url(
+ "product_link_id", product_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str, service_name: str, tag_id: str, product_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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"^[^*#&+:<>?]+$"),
+ "productLinkId": _SERIALIZER.url(
+ "product_link_id", product_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class TagProductLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`tag_product_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.TagProductLinkContract"]:
+ """Lists a collection of the product links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| productId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either TagProductLinkContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagProductLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagProductLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagProductLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, tag_id: str, product_link_id: str, **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Gets the product link for the tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagProductLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagProductLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ product_link_id: str,
+ parameters: _models.TagProductLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Adds a product to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ product_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Adds a product to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ product_link_id: str,
+ parameters: Union[_models.TagProductLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Adds a product to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :param parameters: Create or update parameters. Is either a TagProductLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagProductLinkContract or IO[bytes]
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagProductLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagProductLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, tag_id: str, product_link_id: str, **kwargs: Any
+ ) -> None:
+ """Deletes the specified product from the specified tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # 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 db5c4e3fe86c..222ac7174cdd 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,7 +52,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,7 +72,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -155,7 +158,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TagResourceCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -177,7 +180,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -193,7 +195,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 6c21a0eb1c00..e350db07c309 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar, Union
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,16 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -44,7 +47,7 @@ def build_regenerate_primary_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -64,7 +67,7 @@ def build_regenerate_primary_key_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
}
@@ -89,7 +92,7 @@ def build_regenerate_secondary_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -109,7 +112,7 @@ def build_regenerate_secondary_key_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
}
@@ -161,7 +164,7 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -184,7 +187,6 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -220,7 +222,7 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -243,7 +245,6 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 19aaa7949e6b..2e0dcaba0345 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,16 +21,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +46,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -63,7 +66,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -89,7 +92,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -109,7 +112,7 @@ def build_get_entity_tag_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
}
@@ -134,7 +137,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -154,7 +157,7 @@ def build_get_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
}
@@ -181,7 +184,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -203,7 +206,7 @@ def build_create_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -232,7 +235,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -254,7 +257,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -281,7 +284,7 @@ def build_regenerate_primary_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -301,7 +304,7 @@ def build_regenerate_primary_key_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
}
@@ -326,7 +329,7 @@ def build_regenerate_secondary_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -346,7 +349,7 @@ def build_regenerate_secondary_key_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
}
@@ -371,7 +374,7 @@ def build_list_secrets_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -391,7 +394,7 @@ def build_list_secrets_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
}
@@ -450,7 +453,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AccessInformationCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -470,7 +473,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -486,7 +488,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -534,7 +535,7 @@ def get_entity_tag(
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -557,7 +558,6 @@ def get_entity_tag(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -597,7 +597,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -620,7 +620,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -638,7 +637,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AccessInformationContract", pipeline_response)
+ deserialized = self._deserialize("AccessInformationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -746,7 +745,7 @@ def create(
:rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -782,7 +781,6 @@ def create(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -800,7 +798,7 @@ def create(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AccessInformationContract", pipeline_response)
+ deserialized = self._deserialize("AccessInformationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -908,7 +906,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.AccessInformationContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -944,7 +942,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -962,7 +959,7 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AccessInformationContract", pipeline_response)
+ deserialized = self._deserialize("AccessInformationContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -987,7 +984,7 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1010,7 +1007,6 @@ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1046,7 +1042,7 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1069,7 +1065,6 @@ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1105,7 +1100,7 @@ def list_secrets(
:rtype: ~azure.mgmt.apimanagement.models.AccessInformationSecretsContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1128,7 +1123,6 @@ def list_secrets(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1146,7 +1140,7 @@ def list_secrets(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("AccessInformationSecretsContract", pipeline_response)
+ deserialized = self._deserialize("AccessInformationSecretsContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # 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 043a833ea5b1..86b51c52512d 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,12 +16,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -28,8 +30,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -47,7 +52,7 @@ def build_deploy_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -68,7 +73,7 @@ def build_deploy_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"),
}
@@ -95,7 +100,7 @@ def build_save_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -116,7 +121,7 @@ def build_save_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"),
}
@@ -143,7 +148,7 @@ def build_validate_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -164,7 +169,7 @@ def build_validate_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"),
}
@@ -191,7 +196,7 @@ def build_get_sync_state_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -211,7 +216,7 @@ def build_get_sync_state_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"),
}
@@ -252,8 +257,8 @@ def _deploy_initial(
configuration_name: Union[str, _models.ConfigurationIdName],
parameters: Union[_models.DeployConfigurationParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.OperationResultContract]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -266,7 +271,7 @@ def _deploy_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.OperationResultContract]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -288,10 +293,10 @@ def _deploy_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -299,16 +304,22 @@ def _deploy_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@@ -440,10 +451,11 @@ def begin_deploy(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ deserialized = self._deserialize("OperationResultContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -474,8 +486,8 @@ def _save_initial(
configuration_name: Union[str, _models.ConfigurationIdName],
parameters: Union[_models.SaveConfigurationParameter, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.OperationResultContract]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -488,7 +500,7 @@ def _save_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.OperationResultContract]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -510,10 +522,10 @@ def _save_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -521,16 +533,22 @@ def _save_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@@ -662,10 +680,11 @@ def begin_save(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ deserialized = self._deserialize("OperationResultContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -696,8 +715,8 @@ def _validate_initial(
configuration_name: Union[str, _models.ConfigurationIdName],
parameters: Union[_models.DeployConfigurationParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.OperationResultContract]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -710,7 +729,7 @@ def _validate_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.OperationResultContract]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -732,10 +751,10 @@ def _validate_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -743,16 +762,22 @@ def _validate_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
@@ -872,10 +897,11 @@ def begin_validate(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ deserialized = self._deserialize("OperationResultContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -922,7 +948,7 @@ def get_sync_state(
:rtype: ~azure.mgmt.apimanagement.models.TenantConfigurationSyncStateContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -945,7 +971,6 @@ def get_sync_state(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -960,7 +985,7 @@ def get_sync_state(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("TenantConfigurationSyncStateContract", pipeline_response)
+ deserialized = self._deserialize("TenantConfigurationSyncStateContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 b0ff8cb1e2d2..9ebd94b4e481 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -42,7 +45,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,7 +65,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -88,7 +91,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -108,7 +111,7 @@ def build_get_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"settingsType": _SERIALIZER.url("settings_type", settings_type, "str"),
}
@@ -166,7 +169,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TenantSettingsCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -186,7 +189,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -202,7 +204,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -253,7 +254,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.TenantSettingsContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -276,7 +277,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -294,7 +294,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("TenantSettingsContract", pipeline_response)
+ deserialized = self._deserialize("TenantSettingsContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # 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 a44daf3472b6..5a0bcab34404 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Optional, TypeVar, Union
+import sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -17,16 +18,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -46,7 +49,7 @@ def build_send_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -67,7 +70,7 @@ def build_send_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -129,7 +132,7 @@ def send( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -153,7 +156,6 @@ def send( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
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 1a90bdf33d46..0976fc15b798 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +74,7 @@ def build_list_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -153,7 +156,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GroupCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -176,7 +179,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -192,7 +194,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 2172465cd34d..a4c31d0d2692 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -42,7 +45,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -63,7 +66,7 @@ def build_list_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -121,7 +124,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.UserIdentityCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -141,7 +144,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -157,7 +159,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
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 b888ea9dfd3f..de8f9ddccd3d 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
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,20 +17,26 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +58,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +78,7 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -99,7 +106,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -120,7 +127,7 @@ def build_get_entity_tag_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -140,7 +147,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -161,7 +168,7 @@ def build_get_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -188,7 +195,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -210,7 +217,7 @@ def build_create_or_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -236,7 +243,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -258,7 +265,7 @@ def build_update_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -290,7 +297,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -311,7 +318,7 @@ def build_delete_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -338,7 +345,7 @@ def build_generate_sso_url_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -359,7 +366,7 @@ def build_generate_sso_url_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -379,7 +386,7 @@ def build_get_shared_access_token_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -401,7 +408,7 @@ def build_get_shared_access_token_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -480,7 +487,7 @@ def list_by_service(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.UserCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -503,7 +510,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -519,7 +525,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -565,7 +570,7 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, user_id: s
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -588,7 +593,6 @@ def get_entity_tag(self, resource_group_name: str, service_name: str, user_id: s
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -626,7 +630,7 @@ def get(self, resource_group_name: str, service_name: str, user_id: str, **kwarg
:rtype: ~azure.mgmt.apimanagement.models.UserContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -649,7 +653,6 @@ def get(self, resource_group_name: str, service_name: str, user_id: str, **kwarg
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -667,7 +670,7 @@ def get(self, resource_group_name: str, service_name: str, user_id: str, **kwarg
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("UserContract", pipeline_response)
+ deserialized = self._deserialize("UserContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -783,7 +786,7 @@ def create_or_update(
:rtype: ~azure.mgmt.apimanagement.models.UserContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -820,7 +823,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -836,15 +838,9 @@ def create_or_update(
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"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("UserContract", pipeline_response)
+ deserialized = self._deserialize("UserContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -951,7 +947,7 @@ def update(
:rtype: ~azure.mgmt.apimanagement.models.UserContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -987,7 +983,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1005,15 +1000,14 @@ def update(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("UserContract", pipeline_response)
+ deserialized = self._deserialize("UserContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized # type: ignore
- @distributed_trace
- def delete( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
service_name: str,
@@ -1023,34 +1017,8 @@ def delete( # pylint: disable=inconsistent-return-statements
notify: Optional[bool] = None,
app_type: Optional[Union[str, _models.AppType]] = None,
**kwargs: Any
- ) -> None:
- """Deletes specific user.
-
- :param resource_group_name: The name of the resource group. The name is case insensitive.
- Required.
- :type resource_group_name: str
- :param service_name: The name of the API Management service. Required.
- :type service_name: str
- :param user_id: User identifier. Must be unique in the current API Management service instance.
- Required.
- :type user_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. Required.
- :type if_match: str
- :param delete_subscriptions: Whether to delete user's subscription or not. Default value is
- None.
- :type delete_subscriptions: bool
- :param notify: Send an Account Closed Email notification to the User. Default value is None.
- :type notify: bool
- :param app_type: Determines the type of application which send the create user request. Default
- is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
- None.
- :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
- :return: None or the result of cls(response)
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
- """
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1062,7 +1030,7 @@ def delete( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -1077,23 +1045,123 @@ def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
- if response.status_code not in [200, 204]:
+ if response.status_code not in [202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
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 = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {}) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def begin_delete(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ user_id: str,
+ if_match: str,
+ delete_subscriptions: Optional[bool] = None,
+ notify: Optional[bool] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ **kwargs: Any
+ ) -> LROPoller[None]:
+ """Deletes specific user.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_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. Required.
+ :type if_match: str
+ :param delete_subscriptions: Whether to delete user's subscription or not. Default value is
+ None.
+ :type delete_subscriptions: bool
+ :param notify: Send an Account Closed Email notification to the User. Default value is None.
+ :type notify: bool
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :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:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._delete_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ user_id=user_id,
+ if_match=if_match,
+ delete_subscriptions=delete_subscriptions,
+ notify=notify,
+ app_type=app_type,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+
+ if polling is True:
+ polling_method: PollingMethod = cast(
+ PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[None].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def generate_sso_url(
@@ -1114,7 +1182,7 @@ def generate_sso_url(
:rtype: ~azure.mgmt.apimanagement.models.GenerateSsoUrlResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1137,7 +1205,6 @@ def generate_sso_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1152,7 +1219,7 @@ def generate_sso_url(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("GenerateSsoUrlResult", pipeline_response)
+ deserialized = self._deserialize("GenerateSsoUrlResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1247,7 +1314,7 @@ def get_shared_access_token(
:rtype: ~azure.mgmt.apimanagement.models.UserTokenResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1282,7 +1349,6 @@ def get_shared_access_token(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1297,7 +1363,7 @@ def get_shared_access_token(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("UserTokenResult", pipeline_response)
+ deserialized = self._deserialize("UserTokenResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # 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 f991e90bcbe6..d6b32ff91fd8 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
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+import sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -19,16 +20,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +74,7 @@ def build_list_request(
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", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -97,7 +100,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,7 +122,7 @@ def build_get_request(
),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
@@ -199,7 +202,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SubscriptionCollection] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -222,7 +225,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -238,7 +240,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -289,7 +290,7 @@ def get(
:rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -313,7 +314,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -331,7 +331,7 @@ def get(
response_headers = {}
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
- deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_diagnostic_operations.py
new file mode 100644
index 000000000000..ce2db4baea5f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_diagnostic_operations.py
@@ -0,0 +1,1116 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_workspace_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/diagnostics",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/diagnostics/{diagnosticId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/diagnostics/{diagnosticId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/diagnostics/{diagnosticId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/diagnostics/{diagnosticId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/diagnostics/{diagnosticId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiDiagnosticOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_diagnostic` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_workspace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.DiagnosticContract"]:
+ """Lists all diagnostics of an API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.DiagnosticContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.DiagnosticCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_workspace_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("DiagnosticCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Gets the details of the Diagnostic for an API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("DiagnosticContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ parameters: _models.DiagnosticContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Creates a new Diagnostic for an API or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Creates a new Diagnostic for an API or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ parameters: Union[_models.DiagnosticContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Creates a new Diagnostic for an API or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :param parameters: Create parameters. Is either a DiagnosticContract type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "DiagnosticContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ parameters: _models.DiagnosticUpdateContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Updates the details of the Diagnostic for an API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :param parameters: Diagnostic Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticUpdateContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Updates the details of the Diagnostic for an API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :param parameters: Diagnostic Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ parameters: Union[_models.DiagnosticUpdateContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Updates the details of the Diagnostic for an API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :param parameters: Diagnostic Update parameters. Is either a DiagnosticUpdateContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticUpdateContract or IO[bytes]
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "DiagnosticUpdateContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("DiagnosticContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified Diagnostic from an API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_export_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_export_operations.py
new file mode 100644
index 000000000000..91a4ebf5ba6e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_export_operations.py
@@ -0,0 +1,193 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ subscription_id: str,
+ *,
+ format: Union[str, _models.ExportFormat],
+ export: Union[str, _models.ExportApi],
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["format"] = _SERIALIZER.query("format", format, "str")
+ _params["export"] = _SERIALIZER.query("export", export, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiExportOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_export` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ format: Union[str, _models.ExportFormat],
+ export: Union[str, _models.ExportApi],
+ **kwargs: Any
+ ) -> _models.ApiExportResult:
+ """Gets the details of the API specified by its identifier in the format specified to the Storage
+ Blob with SAS Key valid for 5 minutes.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param format: Format in which to export the Api Details to the Storage Blob with Sas Key valid
+ for 5 minutes. Known values are: "swagger-link", "wsdl-link", "wadl-link", "openapi-link", and
+ "openapi+json-link". Required.
+ :type format: str or ~azure.mgmt.apimanagement.models.ExportFormat
+ :param export: Query parameter required to export the API details. "true" Required.
+ :type export: str or ~azure.mgmt.apimanagement.models.ExportApi
+ :return: ApiExportResult or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiExportResult
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiExportResult] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ format=format,
+ export=export,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiExportResult", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operation_operations.py
new file mode 100644
index 000000000000..8b9fe88d79e3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operation_operations.py
@@ -0,0 +1,1117 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_api_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ tags: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ if tags is not None:
+ _params["tags"] = _SERIALIZER.query("tags", tags, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiOperationOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_operation` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_api(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ tags: Optional[str] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.OperationContract"]:
+ """Lists a collection of the operations for the specified API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains,
+ startswith, endswith |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param tags: Include tags in the response. Default value is None.
+ :type tags: str
+ :return: An iterator like instance of either OperationContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.OperationContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.OperationCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_api_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ tags=tags,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("OperationCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the API operation specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ **kwargs: Any
+ ) -> _models.OperationContract:
+ """Gets the details of the API Operation specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.OperationContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("OperationContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ parameters: _models.OperationContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.OperationContract:
+ """Creates a new operation in the API or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.OperationContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.OperationContract:
+ """Creates a new operation in the API or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ parameters: Union[_models.OperationContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.OperationContract:
+ """Creates a new operation in the API or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param parameters: Create parameters. Is either a OperationContract type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.OperationContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.OperationContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "OperationContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ if_match: str,
+ parameters: _models.OperationUpdateContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.OperationContract:
+ """Updates the details of the operation in the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_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. Required.
+ :type if_match: str
+ :param parameters: API Operation Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.OperationUpdateContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.OperationContract:
+ """Updates the details of the operation in the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_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. Required.
+ :type if_match: str
+ :param parameters: API Operation Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ if_match: str,
+ parameters: Union[_models.OperationUpdateContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.OperationContract:
+ """Updates the details of the operation in the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_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. Required.
+ :type if_match: str
+ :param parameters: API Operation Update parameters. Is either a OperationUpdateContract type or
+ a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.OperationUpdateContract or IO[bytes]
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.OperationContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "OperationUpdateContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("OperationContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified operation in the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operation_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operation_policy_operations.py
new file mode 100644
index 000000000000..bf3aff65e68c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operation_policy_operations.py
@@ -0,0 +1,884 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_operation_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if format is not None:
+ _params["format"] = _SERIALIZER.query("format", format, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiOperationPolicyOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_operation_policy` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_operation(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ **kwargs: Any
+ ) -> Iterable["_models.PolicyContract"]:
+ """Get the list of policy configuration at the API Operation level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :return: An iterator like instance of either PolicyContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.PolicyContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_operation_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the API operation policy specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Get the policy configuration at the API Operation level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is
+ "xml".
+ :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ format=format,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: _models.PolicyContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the API Operation level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the API Operation level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: Union[_models.PolicyContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the API Operation level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the policy configuration at the Api Operation.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operations.py
new file mode 100644
index 000000000000..03dbe47aca7d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operations.py
@@ -0,0 +1,1146 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.arm_polling import ARMPolling
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ tags: Optional[str] = None,
+ expand_api_version_set: Optional[bool] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ if tags is not None:
+ _params["tags"] = _SERIALIZER.query("tags", tags, "str")
+ if expand_api_version_set is not None:
+ _params["expandApiVersionSet"] = _SERIALIZER.query("expand_api_version_set", expand_api_version_set, "bool")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, api_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, api_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ delete_revisions: Optional[bool] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if delete_revisions is not None:
+ _params["deleteRevisions"] = _SERIALIZER.query("delete_revisions", delete_revisions, "bool")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ tags: Optional[str] = None,
+ expand_api_version_set: Optional[bool] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ApiContract"]:
+ """Lists all APIs of the workspace in an API Management service instance.
+
+ .. seealso::
+ - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-create-apis
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains,
+ startswith, endswith || path | filter | ge, le, eq, ne, gt, lt | substringof, contains,
+ startswith, endswith || isCurrent | filter | eq, ne | |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param tags: Include tags in the response. Default value is None.
+ :type tags: str
+ :param expand_api_version_set: Include full ApiVersionSet resource in response. Default value
+ is None.
+ :type expand_api_version_set: bool
+ :return: An iterator like instance of either ApiContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ tags=tags,
+ expand_api_version_set=expand_api_version_set,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, api_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, api_id: str, **kwargs: Any
+ ) -> _models.ApiContract:
+ """Gets the details of the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :return: ApiContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ parameters: Union[_models.ApiCreateOrUpdateParameter, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiCreateOrUpdateParameter")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ parameters: _models.ApiCreateOrUpdateParameter,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiContract]:
+ """Creates new or updates existing specified API of the workspace in an API Management service
+ instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiCreateOrUpdateParameter
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiContract]:
+ """Creates new or updates existing specified API of the workspace in an API Management service
+ instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @distributed_trace
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ parameters: Union[_models.ApiCreateOrUpdateParameter, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiContract]:
+ """Creates new or updates existing specified API of the workspace in an API Management service
+ instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param parameters: Create or update parameters. Is either a ApiCreateOrUpdateParameter type or
+ a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiCreateOrUpdateParameter or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :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:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ parameters=parameters,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("ApiContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: PollingMethod = cast(
+ PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[_models.ApiContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[_models.ApiContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ if_match: str,
+ parameters: _models.ApiUpdateContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiContract:
+ """Updates the specified API of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_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. Required.
+ :type if_match: str
+ :param parameters: API Update Contract parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiUpdateContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiContract:
+ """Updates the specified API of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_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. Required.
+ :type if_match: str
+ :param parameters: API Update Contract parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ if_match: str,
+ parameters: Union[_models.ApiUpdateContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ApiContract:
+ """Updates the specified API of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_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. Required.
+ :type if_match: str
+ :param parameters: API Update Contract parameters. Is either a ApiUpdateContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiUpdateContract or IO[bytes]
+ :return: ApiContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiUpdateContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ if_match: str,
+ delete_revisions: Optional[bool] = None,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified API of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_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. Required.
+ :type if_match: str
+ :param delete_revisions: Delete all revisions of the Api. Default value is None.
+ :type delete_revisions: bool
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ delete_revisions=delete_revisions,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_policy_operations.py
new file mode 100644
index 000000000000..09eb6b125d1c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_policy_operations.py
@@ -0,0 +1,831 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_api_request(
+ resource_group_name: str, service_name: str, workspace_id: str, api_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if format is not None:
+ _params["format"] = _SERIALIZER.query("format", format, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiPolicyOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_policy` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_api(
+ self, resource_group_name: str, service_name: str, workspace_id: str, api_id: str, **kwargs: Any
+ ) -> Iterable["_models.PolicyContract"]:
+ """Get the policy configuration at the API level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :return: An iterator like instance of either PolicyContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.PolicyContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_api_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the API policy specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Get the policy configuration at the API level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is
+ "xml".
+ :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ format=format,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: _models.PolicyContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: Union[_models.PolicyContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the policy configuration at the Api.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_release_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_release_operations.py
new file mode 100644
index 000000000000..e8393a5c239a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_release_operations.py
@@ -0,0 +1,1118 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiReleaseOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_release` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ApiReleaseContract"]:
+ """Lists all releases of an API. An API release is created when making an API Revision current.
+ Releases are also used to rollback to previous revisions. Results will be paged and can be
+ constrained by the $top and $skip parameters.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| notes |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiReleaseContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiReleaseCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiReleaseCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ **kwargs: Any
+ ) -> bool:
+ """Returns the etag of an API release.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ release_id=release_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ **kwargs: Any
+ ) -> _models.ApiReleaseContract:
+ """Returns the details of an API release.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_id: str
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiReleaseContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ release_id=release_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiReleaseContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ parameters: _models.ApiReleaseContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiReleaseContract:
+ """Creates a new Release for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiReleaseContract:
+ """Creates a new Release for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ parameters: Union[_models.ApiReleaseContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.ApiReleaseContract:
+ """Creates a new Release for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_id: str
+ :param parameters: Create parameters. Is either a ApiReleaseContract type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiReleaseContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiReleaseContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ release_id=release_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ if_match: str,
+ parameters: _models.ApiReleaseContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiReleaseContract:
+ """Updates the details of the release of the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_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. Required.
+ :type if_match: str
+ :param parameters: API Release Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiReleaseContract:
+ """Updates the details of the release of the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_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. Required.
+ :type if_match: str
+ :param parameters: API Release Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ if_match: str,
+ parameters: Union[_models.ApiReleaseContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ApiReleaseContract:
+ """Updates the details of the release of the API specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_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. Required.
+ :type if_match: str
+ :param parameters: API Release Update parameters. Is either a ApiReleaseContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO[bytes]
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiReleaseContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiReleaseContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ release_id=release_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiReleaseContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified release in the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param release_id: Release identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type release_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ release_id=release_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_revision_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_revision_operations.py
new file mode 100644
index 000000000000..1c15cbf43948
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_revision_operations.py
@@ -0,0 +1,230 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/revisions",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiRevisionOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_revision` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ApiRevisionContract"]:
+ """Lists all revisions of an API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiRevision
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either ApiRevisionContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiRevisionContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiRevisionCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiRevisionCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_schema_operations.py
new file mode 100644
index 000000000000..9f06c84d95cf
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_schema_operations.py
@@ -0,0 +1,947 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.arm_polling import ARMPolling
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_api_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ force: Optional[bool] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if force is not None:
+ _params["force"] = _SERIALIZER.query("force", force, "bool")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiSchemaOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_schema` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_api(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.SchemaContract"]:
+ """Get the schema configuration at the API level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| contentType
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either SchemaContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.SchemaContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.SchemaCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_api_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("SchemaCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, api_id: 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. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, api_id: str, schema_id: str, **kwargs: Any
+ ) -> _models.SchemaContract:
+ """Get the schema configuration at the API level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :return: SchemaContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SchemaContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.SchemaContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("SchemaContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ parameters: Union[_models.SchemaContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "SchemaContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ parameters: _models.SchemaContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.SchemaContract]:
+ """Creates or updates schema configuration for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :param parameters: The schema contents to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SchemaContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.SchemaContract]:
+ """Creates or updates schema configuration for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :param parameters: The schema contents to apply. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @distributed_trace
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ parameters: Union[_models.SchemaContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> LROPoller[_models.SchemaContract]:
+ """Creates or updates schema configuration for the API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :param parameters: The schema contents to apply. Is either a SchemaContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SchemaContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :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:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.SchemaContract] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ schema_id=schema_id,
+ parameters=parameters,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("SchemaContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: PollingMethod = cast(
+ PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[_models.SchemaContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[_models.SchemaContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ if_match: str,
+ force: Optional[bool] = None,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the schema configuration at the Api.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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. Required.
+ :type api_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :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. Required.
+ :type if_match: str
+ :param force: If true removes all references to the schema before deleting it. Default value is
+ None.
+ :type force: bool
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ force=force,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_version_set_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_version_set_operations.py
new file mode 100644
index 000000000000..80b3dcd2caff
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_version_set_operations.py
@@ -0,0 +1,1048 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiVersionSetOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_version_set` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ApiVersionSetContract"]:
+ """Lists a collection of API Version Sets in the specified workspace with a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either ApiVersionSetContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiVersionSetContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiVersionSetCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiVersionSetCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, version_set_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the Api Version Set specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ version_set_id=version_set_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, version_set_id: str, **kwargs: Any
+ ) -> _models.ApiVersionSetContract:
+ """Gets the details of the Api Version Set specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_id: str
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ApiVersionSetContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ version_set_id=version_set_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiVersionSetContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ parameters: _models.ApiVersionSetContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiVersionSetContract:
+ """Creates or Updates a Api Version Set.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiVersionSetContract:
+ """Creates or Updates a Api Version Set.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ parameters: Union[_models.ApiVersionSetContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.ApiVersionSetContract:
+ """Creates or Updates a Api Version Set.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_id: str
+ :param parameters: Create or update parameters. Is either a ApiVersionSetContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiVersionSetContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiVersionSetContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ version_set_id=version_set_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ if_match: str,
+ parameters: _models.ApiVersionSetUpdateParameters,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiVersionSetContract:
+ """Updates the details of the Api VersionSet specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetUpdateParameters
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ApiVersionSetContract:
+ """Updates the details of the Api VersionSet specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ if_match: str,
+ parameters: Union[_models.ApiVersionSetUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ApiVersionSetContract:
+ """Updates the details of the Api VersionSet specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a ApiVersionSetUpdateParameters type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetUpdateParameters or IO[bytes]
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ApiVersionSetContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiVersionSetUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ version_set_id=version_set_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ApiVersionSetContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes specific Api Version Set.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param version_set_id: Api Version Set identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type version_set_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ version_set_id=version_set_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_backend_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_backend_operations.py
new file mode 100644
index 000000000000..24414e8ab51a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_backend_operations.py
@@ -0,0 +1,1030 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_workspace_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/backends",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, backend_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/backends/{backendId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, backend_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/backends/{backendId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/backends/{backendId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/backends/{backendId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/backends/{backendId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceBackendOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_backend` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_workspace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.BackendContract"]:
+ """Lists a collection of backends in the specified workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || title |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || url |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either BackendContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.BackendContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.BackendCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_workspace_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("BackendCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, backend_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the backend specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ backend_id=backend_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, backend_id: str, **kwargs: Any
+ ) -> _models.BackendContract:
+ """Gets the details of the backend specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_id: str
+ :return: BackendContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.BackendContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.BackendContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ backend_id=backend_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("BackendContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ parameters: _models.BackendContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.BackendContract:
+ """Creates or Updates a backend.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.BackendContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: BackendContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.BackendContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.BackendContract:
+ """Creates or Updates a backend.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: BackendContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.BackendContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ parameters: Union[_models.BackendContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.BackendContract:
+ """Creates or Updates a backend.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_id: str
+ :param parameters: Create parameters. Is either a BackendContract type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.BackendContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: BackendContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.BackendContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.BackendContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "BackendContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ backend_id=backend_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ if_match: str,
+ parameters: _models.BackendUpdateParameters,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.BackendContract:
+ """Updates an existing backend.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.BackendUpdateParameters
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: BackendContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.BackendContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.BackendContract:
+ """Updates an existing backend.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: BackendContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.BackendContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ if_match: str,
+ parameters: Union[_models.BackendUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.BackendContract:
+ """Updates an existing backend.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a BackendUpdateParameters type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.BackendUpdateParameters or IO[bytes]
+ :return: BackendContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.BackendContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.BackendContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "BackendUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ backend_id=backend_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("BackendContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ backend_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified backend.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param backend_id: Identifier of the Backend entity. Must be unique in the current API
+ Management service instance. Required.
+ :type backend_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ backend_id=backend_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_certificate_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_certificate_operations.py
new file mode 100644
index 000000000000..19d28cb79fa6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_certificate_operations.py
@@ -0,0 +1,967 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_workspace_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ is_key_vault_refresh_failed: Optional[bool] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/certificates",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ if is_key_vault_refresh_failed is not None:
+ _params["isKeyVaultRefreshFailed"] = _SERIALIZER.query(
+ "is_key_vault_refresh_failed", is_key_vault_refresh_failed, "bool"
+ )
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ certificate_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/certificates/{certificateId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ certificate_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/certificates/{certificateId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ certificate_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/certificates/{certificateId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ certificate_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/certificates/{certificateId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_refresh_secret_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ certificate_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/certificates/{certificateId}/refreshSecret",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceCertificateOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_certificate` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_workspace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ is_key_vault_refresh_failed: Optional[bool] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.CertificateContract"]:
+ """Lists a collection of all certificates in the specified workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || subject |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || expirationDate | filter | ge, le, eq, ne, gt, lt | |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param is_key_vault_refresh_failed: When set to true, the response contains only certificates
+ entities which failed refresh. Default value is None.
+ :type is_key_vault_refresh_failed: bool
+ :return: An iterator like instance of either CertificateContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.CertificateContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.CertificateCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_workspace_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ is_key_vault_refresh_failed=is_key_vault_refresh_failed,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("CertificateCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, certificate_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the certificate specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param certificate_id: Identifier of the certificate entity. Must be unique in the current API
+ Management service instance. Required.
+ :type certificate_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ certificate_id=certificate_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, certificate_id: str, **kwargs: Any
+ ) -> _models.CertificateContract:
+ """Gets the details of the certificate specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param certificate_id: Identifier of the certificate entity. Must be unique in the current API
+ Management service instance. Required.
+ :type certificate_id: str
+ :return: CertificateContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.CertificateContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.CertificateContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ certificate_id=certificate_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("CertificateContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ certificate_id: str,
+ parameters: _models.CertificateCreateOrUpdateParameters,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.CertificateContract:
+ """Creates or updates the certificate being used for authentication with the backend.
+
+ .. seealso::
+ -
+ https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param certificate_id: Identifier of the certificate entity. Must be unique in the current API
+ Management service instance. Required.
+ :type certificate_id: str
+ :param parameters: Create or Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.CertificateCreateOrUpdateParameters
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: CertificateContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.CertificateContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ certificate_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.CertificateContract:
+ """Creates or updates the certificate being used for authentication with the backend.
+
+ .. seealso::
+ -
+ https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param certificate_id: Identifier of the certificate entity. Must be unique in the current API
+ Management service instance. Required.
+ :type certificate_id: str
+ :param parameters: Create or Update parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: CertificateContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.CertificateContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ certificate_id: str,
+ parameters: Union[_models.CertificateCreateOrUpdateParameters, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.CertificateContract:
+ """Creates or updates the certificate being used for authentication with the backend.
+
+ .. seealso::
+ -
+ https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param certificate_id: Identifier of the certificate entity. Must be unique in the current API
+ Management service instance. Required.
+ :type certificate_id: str
+ :param parameters: Create or Update parameters. Is either a CertificateCreateOrUpdateParameters
+ type or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.CertificateCreateOrUpdateParameters or
+ IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: CertificateContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.CertificateContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.CertificateContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ certificate_id=certificate_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ certificate_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes specific certificate.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param certificate_id: Identifier of the certificate entity. Must be unique in the current API
+ Management service instance. Required.
+ :type certificate_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ certificate_id=certificate_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
+
+ @distributed_trace
+ def refresh_secret(
+ self, resource_group_name: str, service_name: str, workspace_id: str, certificate_id: str, **kwargs: Any
+ ) -> _models.CertificateContract:
+ """From KeyVault, Refresh the certificate being used for authentication with the backend.
+
+ .. seealso::
+ -
+ https://azure.microsoft.com/en-us/documentation/articles/api-management-howto-mutual-certificates/
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param certificate_id: Identifier of the certificate entity. Must be unique in the current API
+ Management service instance. Required.
+ :type certificate_id: str
+ :return: CertificateContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.CertificateContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.CertificateContract] = kwargs.pop("cls", None)
+
+ _request = build_refresh_secret_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ certificate_id=certificate_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("CertificateContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_diagnostic_operations.py
new file mode 100644
index 000000000000..58700f8c2a41
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_diagnostic_operations.py
@@ -0,0 +1,1048 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_workspace_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/diagnostics",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/diagnostics/{diagnosticId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/diagnostics/{diagnosticId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/diagnostics/{diagnosticId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/diagnostics/{diagnosticId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/diagnostics/{diagnosticId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceDiagnosticOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_diagnostic` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_workspace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.DiagnosticContract"]:
+ """Lists all diagnostics in the specified workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.DiagnosticContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.DiagnosticCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_workspace_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("DiagnosticCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, diagnostic_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the Diagnostic specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, diagnostic_id: str, **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Gets the details of the Diagnostic specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("DiagnosticContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ parameters: _models.DiagnosticContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Creates a new Diagnostic or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Creates a new Diagnostic or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ parameters: Union[_models.DiagnosticContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Creates a new Diagnostic or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_id: str
+ :param parameters: Create parameters. Is either a DiagnosticContract type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "DiagnosticContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ parameters: _models.DiagnosticUpdateContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Updates the details of the Diagnostic specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :param parameters: Diagnostic Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticUpdateContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Updates the details of the Diagnostic specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :param parameters: Diagnostic Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ parameters: Union[_models.DiagnosticUpdateContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.DiagnosticContract:
+ """Updates the details of the Diagnostic specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :param parameters: Diagnostic Update parameters. Is either a DiagnosticUpdateContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.DiagnosticUpdateContract or IO[bytes]
+ :return: DiagnosticContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.DiagnosticContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.DiagnosticContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "DiagnosticUpdateContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("DiagnosticContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ diagnostic_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified Diagnostic.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param diagnostic_id: Diagnostic identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type diagnostic_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ diagnostic_id=diagnostic_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_global_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_global_schema_operations.py
new file mode 100644
index 000000000000..0f1439928b26
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_global_schema_operations.py
@@ -0,0 +1,890 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.arm_polling import ARMPolling
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, schema_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, schema_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceGlobalSchemaOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_global_schema` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.GlobalSchemaContract"]:
+ """Lists a collection of schemas registered with workspace in a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either GlobalSchemaContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.GlobalSchemaContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.GlobalSchemaCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _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) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: 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. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: 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. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :return: GlobalSchemaContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GlobalSchemaContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.GlobalSchemaContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ parameters: Union[_models.GlobalSchemaContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GlobalSchemaContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ parameters: _models.GlobalSchemaContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.GlobalSchemaContract]:
+ """Creates new or updates existing specified Schema of the workspace in an API Management service
+ instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :param parameters: Create or update parameters. Required.
+ :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. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.GlobalSchemaContract]:
+ """Creates new or updates existing specified Schema of the workspace in an API Management service
+ instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @distributed_trace
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ parameters: Union[_models.GlobalSchemaContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> LROPoller[_models.GlobalSchemaContract]:
+ """Creates new or updates existing specified Schema of the workspace in an API Management service
+ instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type schema_id: str
+ :param parameters: Create or update parameters. Is either a GlobalSchemaContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GlobalSchemaContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :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:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.GlobalSchemaContract] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ schema_id=schema_id,
+ parameters=parameters,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: PollingMethod = cast(
+ PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[_models.GlobalSchemaContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[_models.GlobalSchemaContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes specific Schema.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param schema_id: Schema id identifier. Must be unique in the current API Management service
+ instance. Required.
+ :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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_group_operations.py
new file mode 100644
index 000000000000..b44b5deddb01
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_group_operations.py
@@ -0,0 +1,1033 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, group_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, group_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceGroupOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_group` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.GroupContract"]:
+ """Lists a collection of groups defined within a workspace in a service instance.
+
+ .. seealso::
+ - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-create-groups
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || externalId | filter | eq | |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either GroupContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.GroupContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.GroupCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("GroupCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, group_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the group specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, group_id: str, **kwargs: Any
+ ) -> _models.GroupContract:
+ """Gets the details of the group specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.GroupContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("GroupContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ parameters: _models.GroupCreateParameters,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GroupContract:
+ """Creates or Updates a group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GroupCreateParameters
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GroupContract:
+ """Creates or Updates a group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ parameters: Union[_models.GroupCreateParameters, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.GroupContract:
+ """Creates or Updates a group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param parameters: Create parameters. Is either a GroupCreateParameters type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GroupCreateParameters or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.GroupContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GroupCreateParameters")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ if_match: str,
+ parameters: _models.GroupUpdateParameters,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GroupContract:
+ """Updates the details of the group specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GroupUpdateParameters
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GroupContract:
+ """Updates the details of the group specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ if_match: str,
+ parameters: Union[_models.GroupUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.GroupContract:
+ """Updates the details of the group specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a GroupUpdateParameters type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GroupUpdateParameters or IO[bytes]
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.GroupContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GroupUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("GroupContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes specific group of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_group_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_group_user_operations.py
new file mode 100644
index 000000000000..fc22584d84cf
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_group_user_operations.py
@@ -0,0 +1,590 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_check_entity_exists_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ user_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ user_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ user_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceGroupUserOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_group_user` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.UserContract"]:
+ """Lists a collection of user entities associated with the group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || firstName
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || registrationDate | filter | ge, le, eq, ne, gt, lt | || note | filter | ge,
+ le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either UserContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.UserContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.UserCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("UserCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def check_entity_exists(
+ self, resource_group_name: str, service_name: str, workspace_id: str, group_id: str, user_id: str, **kwargs: Any
+ ) -> bool:
+ """Checks that user entity specified by identifier is associated with the group entity.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_check_entity_exists_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ user_id=user_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def create(
+ self, resource_group_name: str, service_name: str, workspace_id: str, group_id: str, user_id: str, **kwargs: Any
+ ) -> _models.UserContract:
+ """Add existing user to existing group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_id: str
+ :return: UserContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.UserContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.UserContract] = kwargs.pop("cls", None)
+
+ _request = build_create_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ user_id=user_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("UserContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, workspace_id: str, group_id: str, user_id: str, **kwargs: Any
+ ) -> None:
+ """Remove existing user from existing group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ user_id=user_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_logger_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_logger_operations.py
new file mode 100644
index 000000000000..cbd1da71dc58
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_logger_operations.py
@@ -0,0 +1,1033 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_workspace_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/loggers",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, logger_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/loggers/{loggerId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, logger_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/loggers/{loggerId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/loggers/{loggerId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/loggers/{loggerId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/loggers/{loggerId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceLoggerOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_logger` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_workspace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.LoggerContract"]:
+ """Lists a collection of loggers in the specified workspace.
+
+ .. seealso::
+ - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-log-event-hubs
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || loggerType | filter | eq | || resourceId | filter | ge, le, eq, ne, gt, lt |
+ substringof, contains, startswith, endswith |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either LoggerContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.LoggerContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.LoggerCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_workspace_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("LoggerCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, logger_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the logger specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ logger_id=logger_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, logger_id: str, **kwargs: Any
+ ) -> _models.LoggerContract:
+ """Gets the details of the logger specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_id: str
+ :return: LoggerContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.LoggerContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.LoggerContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ logger_id=logger_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("LoggerContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ parameters: _models.LoggerContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.LoggerContract:
+ """Creates or Updates a logger.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.LoggerContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: LoggerContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.LoggerContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.LoggerContract:
+ """Creates or Updates a logger.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: LoggerContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.LoggerContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ parameters: Union[_models.LoggerContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.LoggerContract:
+ """Creates or Updates a logger.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_id: str
+ :param parameters: Create parameters. Is either a LoggerContract type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.LoggerContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: LoggerContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.LoggerContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.LoggerContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "LoggerContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ logger_id=logger_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ if_match: str,
+ parameters: _models.LoggerUpdateContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.LoggerContract:
+ """Updates an existing logger.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.LoggerUpdateContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: LoggerContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.LoggerContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.LoggerContract:
+ """Updates an existing logger.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: LoggerContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.LoggerContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ if_match: str,
+ parameters: Union[_models.LoggerUpdateContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.LoggerContract:
+ """Updates an existing logger.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a LoggerUpdateContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.LoggerUpdateContract or IO[bytes]
+ :return: LoggerContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.LoggerContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.LoggerContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "LoggerUpdateContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ logger_id=logger_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("LoggerContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ logger_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified logger.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param logger_id: Logger identifier. Must be unique in the API Management service instance.
+ Required.
+ :type logger_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ logger_id=logger_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_named_value_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_named_value_operations.py
new file mode 100644
index 000000000000..dd54bf5ad31e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_named_value_operations.py
@@ -0,0 +1,1526 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.arm_polling import ARMPolling
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ is_key_vault_refresh_failed: Optional[Union[str, _models.KeyVaultRefreshState]] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ if is_key_vault_refresh_failed is not None:
+ _params["isKeyVaultRefreshFailed"] = _SERIALIZER.query(
+ "is_key_vault_refresh_failed", is_key_vault_refresh_failed, "str"
+ )
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "namedValueId": _SERIALIZER.url(
+ "named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "namedValueId": _SERIALIZER.url(
+ "named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "namedValueId": _SERIALIZER.url(
+ "named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "namedValueId": _SERIALIZER.url(
+ "named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "namedValueId": _SERIALIZER.url(
+ "named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_list_value_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/listValue",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "namedValueId": _SERIALIZER.url(
+ "named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_refresh_secret_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/refreshSecret",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "namedValueId": _SERIALIZER.url(
+ "named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceNamedValueOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_named_value` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ is_key_vault_refresh_failed: Optional[Union[str, _models.KeyVaultRefreshState]] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.NamedValueContract"]:
+ """Lists a collection of named values defined within a workspace in a service instance.
+
+ .. seealso::
+ - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-properties
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| tags |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param is_key_vault_refresh_failed: Query parameter to fetch named value entities based on
+ refresh status. Known values are: "true" and "false". Default value is None.
+ :type is_key_vault_refresh_failed: str or ~azure.mgmt.apimanagement.models.KeyVaultRefreshState
+ :return: An iterator like instance of either NamedValueContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.NamedValueContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.NamedValueCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ is_key_vault_refresh_failed=is_key_vault_refresh_failed,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("NamedValueCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, named_value_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the named value specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, named_value_id: str, **kwargs: Any
+ ) -> _models.NamedValueContract:
+ """Gets the details of the named value specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_id: str
+ :return: NamedValueContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NamedValueContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("NamedValueContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ parameters: Union[_models.NamedValueCreateContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "NamedValueCreateContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ parameters: _models.NamedValueCreateContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.NamedValueContract]:
+ """Creates or updates named value.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.NamedValueCreateContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.NamedValueContract]:
+ """Creates or updates named value.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @distributed_trace
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ parameters: Union[_models.NamedValueCreateContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> LROPoller[_models.NamedValueContract]:
+ """Creates or updates named value.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_id: str
+ :param parameters: Create parameters. Is either a NamedValueCreateContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.NamedValueCreateContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :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:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ parameters=parameters,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("NamedValueContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: PollingMethod = cast(
+ PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[_models.NamedValueContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[_models.NamedValueContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ def _update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ if_match: str,
+ parameters: Union[_models.NamedValueUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "NamedValueUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def begin_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ if_match: str,
+ parameters: _models.NamedValueUpdateParameters,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.NamedValueContract]:
+ """Updates the specific named value.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.NamedValueUpdateParameters
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @overload
+ def begin_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.NamedValueContract]:
+ """Updates the specific named value.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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:
+ """
+
+ @distributed_trace
+ def begin_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ if_match: str,
+ parameters: Union[_models.NamedValueUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> LROPoller[_models.NamedValueContract]:
+ """Updates the specific named value.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a NamedValueUpdateParameters type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.NamedValueUpdateParameters or IO[bytes]
+ :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:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._update_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ if_match=if_match,
+ parameters=parameters,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ 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("NamedValueContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: PollingMethod = cast(
+ PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[_models.NamedValueContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[_models.NamedValueContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes specific named value from the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
+
+ @distributed_trace
+ def list_value(
+ self, resource_group_name: str, service_name: str, workspace_id: str, named_value_id: str, **kwargs: Any
+ ) -> _models.NamedValueSecretContract:
+ """Gets the secret of the named value specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_id: str
+ :return: NamedValueSecretContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NamedValueSecretContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.NamedValueSecretContract] = kwargs.pop("cls", None)
+
+ _request = build_list_value_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("NamedValueSecretContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ def _refresh_secret_initial(
+ self, resource_group_name: str, service_name: str, workspace_id: str, named_value_id: str, **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ _request = build_refresh_secret_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def begin_refresh_secret(
+ self, resource_group_name: str, service_name: str, workspace_id: str, named_value_id: str, **kwargs: Any
+ ) -> LROPoller[_models.NamedValueContract]:
+ """Refresh the secret of the named value specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param named_value_id: Identifier of the NamedValue. Required.
+ :type named_value_id: str
+ :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:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._refresh_secret_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ 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("NamedValueContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: PollingMethod = cast(
+ PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[_models.NamedValueContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[_models.NamedValueContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_notification_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_notification_operations.py
new file mode 100644
index 000000000000..d6dc72aa4438
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_notification_operations.py
@@ -0,0 +1,467 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceNotificationOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_notification` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.NotificationContract"]:
+ """Lists a collection of properties defined within a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either NotificationContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.NotificationContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.NotificationCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("NotificationCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ **kwargs: Any
+ ) -> _models.NotificationContract:
+ """Gets the details of the Notification specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :return: NotificationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NotificationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.NotificationContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("NotificationContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.NotificationContract:
+ """Create or Update API Management publisher notification for the workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: NotificationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NotificationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.NotificationContract] = kwargs.pop("cls", None)
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("NotificationContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_notification_recipient_email_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_notification_recipient_email_operations.py
new file mode 100644
index 000000000000..3753a36fd86a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_notification_recipient_email_operations.py
@@ -0,0 +1,556 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_notification_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_check_entity_exists_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ email: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
+ "email": _SERIALIZER.url("email", email, "str"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ email: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
+ "email": _SERIALIZER.url("email", email, "str"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ email: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
+ "email": _SERIALIZER.url("email", email, "str"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceNotificationRecipientEmailOperations: # pylint: disable=name-too-long
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_notification_recipient_email` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_notification(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ **kwargs: Any
+ ) -> _models.RecipientEmailCollection:
+ """Gets the list of the Notification Recipient Emails subscribed to a notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :return: RecipientEmailCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientEmailCollection
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.RecipientEmailCollection] = kwargs.pop("cls", None)
+
+ _request = build_list_by_notification_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("RecipientEmailCollection", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def check_entity_exists(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ email: str,
+ **kwargs: Any
+ ) -> bool:
+ """Determine if Notification Recipient Email subscribed to the notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :param email: Email identifier. Required.
+ :type email: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_check_entity_exists_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ email=email,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ email: str,
+ **kwargs: Any
+ ) -> _models.RecipientEmailContract:
+ """Adds the Email address to the list of Recipients for the Notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :param email: Email identifier. Required.
+ :type email: str
+ :return: RecipientEmailContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientEmailContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.RecipientEmailContract] = kwargs.pop("cls", None)
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ email=email,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("RecipientEmailContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ email: str,
+ **kwargs: Any
+ ) -> None:
+ """Removes the email from the list of Notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :param email: Email identifier. Required.
+ :type email: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ email=email,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_notification_recipient_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_notification_recipient_user_operations.py
new file mode 100644
index 000000000000..ce91ce3b3c60
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_notification_recipient_user_operations.py
@@ -0,0 +1,559 @@
+# pylint: disable=too-many-lines,too-many-statements
+# 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 sys
+from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_notification_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_check_entity_exists_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ user_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ user_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ user_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceNotificationRecipientUserOperations: # pylint: disable=name-too-long
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_notification_recipient_user` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_notification(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ **kwargs: Any
+ ) -> _models.RecipientUserCollection:
+ """Gets the list of the Notification Recipient User subscribed to the notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :return: RecipientUserCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientUserCollection
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.RecipientUserCollection] = kwargs.pop("cls", None)
+
+ _request = build_list_by_notification_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("RecipientUserCollection", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def check_entity_exists(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ user_id: str,
+ **kwargs: Any
+ ) -> bool:
+ """Determine if the Notification Recipient User is subscribed to the notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_check_entity_exists_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ user_id=user_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ user_id: str,
+ **kwargs: Any
+ ) -> _models.RecipientUserContract:
+ """Adds the API Management User to the list of Recipients for the Notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_id: str
+ :return: RecipientUserContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientUserContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.RecipientUserContract] = kwargs.pop("cls", None)
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ user_id=user_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("RecipientUserContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ user_id: str,
+ **kwargs: Any
+ ) -> None:
+ """Removes the API Management user from the list of Notification.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param notification_name: Notification Name Identifier. Known values are:
+ "RequestPublisherNotificationMessage", "PurchasePublisherNotificationMessage",
+ "NewApplicationNotificationMessage", "BCC", "NewIssuePublisherNotificationMessage",
+ "AccountClosedPublisher", and "QuotaLimitApproachingPublisherNotificationMessage". Required.
+ :type notification_name: str or ~azure.mgmt.apimanagement.models.NotificationName
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ notification_name=notification_name,
+ user_id=user_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_operations.py
new file mode 100644
index 000000000000..8459ad7f5ca4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_operations.py
@@ -0,0 +1,966 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str,
+ service_name: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @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
+ ) -> Iterable["_models.WorkspaceContract"]:
+ """Lists all workspaces of the API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| displayName
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.WorkspaceContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.WorkspaceCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("WorkspaceCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(self, resource_group_name: str, service_name: str, workspace_id: str, **kwargs: Any) -> bool:
+ """Gets the entity state (Etag) version of the workspace specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, **kwargs: Any
+ ) -> _models.WorkspaceContract:
+ """Gets the details of the workspace specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.WorkspaceContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("WorkspaceContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ parameters: _models.WorkspaceContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.WorkspaceContract:
+ """Creates a new workspace or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.WorkspaceContract:
+ """Creates a new workspace or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ parameters: Union[_models.WorkspaceContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.WorkspaceContract:
+ """Creates a new workspace or updates an existing one.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param parameters: Create parameters. Is either a WorkspaceContract type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.WorkspaceContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.WorkspaceContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "WorkspaceContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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("WorkspaceContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ if_match: str,
+ parameters: _models.WorkspaceContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.WorkspaceContract:
+ """Updates the details of the workspace specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_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. Required.
+ :type if_match: str
+ :param parameters: Workspace Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.WorkspaceContract:
+ """Updates the details of the workspace specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_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. Required.
+ :type if_match: str
+ :param parameters: Workspace Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ if_match: str,
+ parameters: Union[_models.WorkspaceContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.WorkspaceContract:
+ """Updates the details of the workspace specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_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. Required.
+ :type if_match: str
+ :param parameters: Workspace Update parameters. Is either a WorkspaceContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.WorkspaceContract or IO[bytes]
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.WorkspaceContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "WorkspaceContract")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("WorkspaceContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, workspace_id: str, if_match: str, **kwargs: Any
+ ) -> None:
+ """Deletes the specified workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_policy_fragment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_policy_fragment_operations.py
new file mode 100644
index 000000000000..4beb25df17c8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_policy_fragment_operations.py
@@ -0,0 +1,1037 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.arm_polling import ARMPolling
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ orderby: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if orderby is not None:
+ _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ subscription_id: str,
+ *,
+ format: Optional[Union[str, _models.PolicyFragmentContentFormat]] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+ if format is not None:
+ _params["format"] = _SERIALIZER.query("format", format, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_list_references_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ subscription_id: str,
+ *,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}/listReferences",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspacePolicyFragmentOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_policy_fragment` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ orderby: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.PolicyFragmentContract"]:
+ """Gets all policy fragments defined within a workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ |. Default value is None.
+ :type filter: str
+ :param orderby: OData order by query option. Default value is None.
+ :type orderby: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either PolicyFragmentContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.PolicyFragmentContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyFragmentCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ orderby=orderby,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyFragmentCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of a policy fragment.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param id: A resource identifier. Required.
+ :type id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ id=id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ format: Optional[Union[str, _models.PolicyFragmentContentFormat]] = None,
+ **kwargs: Any
+ ) -> _models.PolicyFragmentContract:
+ """Gets a policy fragment.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param id: A resource identifier. Required.
+ :type id: str
+ :param format: Policy fragment content format. Known values are: "xml" and "rawxml". Default
+ value is None.
+ :type format: str or ~azure.mgmt.apimanagement.models.PolicyFragmentContentFormat
+ :return: PolicyFragmentContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyFragmentContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyFragmentContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ id=id,
+ subscription_id=self._config.subscription_id,
+ format=format,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyFragmentContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ parameters: Union[_models.PolicyFragmentContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyFragmentContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ id=id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ parameters: _models.PolicyFragmentContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.PolicyFragmentContract]:
+ """Creates or updates a policy fragment.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param id: A resource identifier. Required.
+ :type id: str
+ :param parameters: The policy fragment contents to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyFragmentContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of LROPoller that returns either PolicyFragmentContract or the result of
+ cls(response)
+ :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PolicyFragmentContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.PolicyFragmentContract]:
+ """Creates or updates a policy fragment.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param id: A resource identifier. Required.
+ :type id: str
+ :param parameters: The policy fragment contents to apply. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of LROPoller that returns either PolicyFragmentContract or the result of
+ cls(response)
+ :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PolicyFragmentContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ parameters: Union[_models.PolicyFragmentContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> LROPoller[_models.PolicyFragmentContract]:
+ """Creates or updates a policy fragment.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param id: A resource identifier. Required.
+ :type id: str
+ :param parameters: The policy fragment contents to apply. Is either a PolicyFragmentContract
+ type or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyFragmentContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: An instance of LROPoller that returns either PolicyFragmentContract or the result of
+ cls(response)
+ :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PolicyFragmentContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.PolicyFragmentContract] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ id=id,
+ parameters=parameters,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("PolicyFragmentContract", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: PollingMethod = cast(
+ PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[_models.PolicyFragmentContract].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[_models.PolicyFragmentContract](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, workspace_id: str, id: str, if_match: str, **kwargs: Any
+ ) -> None:
+ """Deletes a policy fragment.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param id: A resource identifier. Required.
+ :type 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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ id=id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
+
+ @distributed_trace
+ def list_references(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> _models.ResourceCollection:
+ """Lists policy resources that reference the policy fragment.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param id: A resource identifier. Required.
+ :type id: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: ResourceCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ResourceCollection
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ResourceCollection] = kwargs.pop("cls", None)
+
+ _request = build_list_references_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ id=id,
+ subscription_id=self._config.subscription_id,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ResourceCollection", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_policy_operations.py
new file mode 100644
index 000000000000..290bc04e6022
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_policy_operations.py
@@ -0,0 +1,790 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_api_request(
+ resource_group_name: str, service_name: str, workspace_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if format is not None:
+ _params["format"] = _SERIALIZER.query("format", format, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspacePolicyOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_policy` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_api(
+ self, resource_group_name: str, service_name: str, workspace_id: str, **kwargs: Any
+ ) -> Iterable["_models.PolicyContract"]:
+ """Get the policy configuration at the workspace level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :return: An iterator like instance of either PolicyContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.PolicyContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_api_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("PolicyCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the workspace policy specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Get the policy configuration at the API level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is
+ "xml".
+ :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ format=format,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: _models.PolicyContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: Union[_models.PolicyContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the policy configuration at the workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_api_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_api_link_operations.py
new file mode 100644
index 000000000000..371e54166085
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_api_link_operations.py
@@ -0,0 +1,715 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_product_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
+ "apiLinkId": _SERIALIZER.url(
+ "api_link_id", api_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
+ "apiLinkId": _SERIALIZER.url(
+ "api_link_id", api_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
+ "apiLinkId": _SERIALIZER.url(
+ "api_link_id", api_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceProductApiLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_product_api_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ProductApiLinkContract"]:
+ """Lists a collection of the API links associated with a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either ProductApiLinkContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ProductApiLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductApiLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ProductApiLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Gets the API link for the product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductApiLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ProductApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ parameters: _models.ProductApiLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Adds an API to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Adds an API to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ parameters: Union[_models.ProductApiLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ProductApiLinkContract:
+ """Adds an API to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Is either a ProductApiLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductApiLinkContract or IO[bytes]
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ProductApiLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductApiLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified API from the specified product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param api_link_id: Product-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_group_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_group_link_operations.py
new file mode 100644
index 000000000000..33d6336a8f1f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_group_link_operations.py
@@ -0,0 +1,715 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_product_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
+ "groupLinkId": _SERIALIZER.url(
+ "group_link_id", group_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
+ "groupLinkId": _SERIALIZER.url(
+ "group_link_id", group_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
+ "groupLinkId": _SERIALIZER.url(
+ "group_link_id", group_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceProductGroupLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_product_group_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ProductGroupLinkContract"]:
+ """Lists a collection of the group links associated with a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| groupId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either ProductGroupLinkContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ProductGroupLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductGroupLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ProductGroupLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Gets the group link for the product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductGroupLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ProductGroupLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ parameters: _models.ProductGroupLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Adds a group to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Adds a group to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ parameters: Union[_models.ProductGroupLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ProductGroupLinkContract:
+ """Adds a group to the specified product via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :param parameters: Create or update parameters. Is either a ProductGroupLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract or IO[bytes]
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ProductGroupLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductGroupLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified group from the specified product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param group_link_id: Product-Group link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type group_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_operations.py
new file mode 100644
index 000000000000..e1bd5cb5b353
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_operations.py
@@ -0,0 +1,1055 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ expand_groups: Optional[bool] = None,
+ tags: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ if expand_groups is not None:
+ _params["expandGroups"] = _SERIALIZER.query("expand_groups", expand_groups, "bool")
+ if tags is not None:
+ _params["tags"] = _SERIALIZER.query("tags", tags, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, product_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, product_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ delete_subscriptions: Optional[bool] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if delete_subscriptions is not None:
+ _params["deleteSubscriptions"] = _SERIALIZER.query("delete_subscriptions", delete_subscriptions, "bool")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceProductOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_product` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ expand_groups: Optional[bool] = None,
+ tags: Optional[str] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ProductContract"]:
+ """Lists a collection of products in the specified workspace in a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || state | filter | eq | || groups | expand | | |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param expand_groups: When set to true, the response contains an array of groups that have
+ visibility to the product. The default is false. Default value is None.
+ :type expand_groups: bool
+ :param tags: Products which are part of a specific tag. Default value is None.
+ :type tags: str
+ :return: An iterator like instance of either ProductContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ProductContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ expand_groups=expand_groups,
+ tags=tags,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ProductCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, product_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the product specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, product_id: str, **kwargs: Any
+ ) -> _models.ProductContract:
+ """Gets the details of the product specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.ProductContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ProductContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ parameters: _models.ProductContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductContract:
+ """Creates or Updates a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductContract:
+ """Creates or Updates a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ parameters: Union[_models.ProductContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.ProductContract:
+ """Creates or Updates a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param parameters: Create or update parameters. Is either a ProductContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ProductContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ if_match: str,
+ parameters: _models.ProductUpdateParameters,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductContract:
+ """Update existing product details.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductUpdateParameters
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.ProductContract:
+ """Update existing product details.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ if_match: str,
+ parameters: Union[_models.ProductUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.ProductContract:
+ """Update existing product details.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a ProductUpdateParameters type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductUpdateParameters or IO[bytes]
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.ProductContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("ProductContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ if_match: str,
+ delete_subscriptions: Optional[bool] = None,
+ **kwargs: Any
+ ) -> None:
+ """Delete product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_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. Required.
+ :type if_match: str
+ :param delete_subscriptions: Delete existing subscriptions associated with the product or not.
+ Default value is None.
+ :type delete_subscriptions: bool
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ delete_subscriptions=delete_subscriptions,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_policy_operations.py
new file mode 100644
index 000000000000..7ce07529dad3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_policy_operations.py
@@ -0,0 +1,803 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_product_request(
+ resource_group_name: str, service_name: str, workspace_id: str, product_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if format is not None:
+ _params["format"] = _SERIALIZER.query("format", format, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceProductPolicyOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_product_policy` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self, resource_group_name: str, service_name: str, workspace_id: str, product_id: str, **kwargs: Any
+ ) -> _models.PolicyCollection:
+ """Get the policy configuration at the Product level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :return: PolicyCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyCollection] = kwargs.pop("cls", None)
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyCollection", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def get_entity_tag(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ **kwargs: Any
+ ) -> bool:
+ """Get the ETag of the policy configuration at the Product level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Get the policy configuration at the Product level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param format: Policy Export Format. Known values are: "xml" and "rawxml". Default value is
+ "xml".
+ :type format: str or ~azure.mgmt.apimanagement.models.PolicyExportFormat
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ format=format,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("PolicyContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: _models.PolicyContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the Product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the Product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ parameters: Union[_models.PolicyContract, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.PolicyContract:
+ """Creates or updates policy configuration for the Product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :param parameters: The policy contents to apply. Is either a PolicyContract type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.PolicyContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ if_match: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the policy configuration at the Product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param policy_id: The identifier of the Policy. "policy" Required.
+ :type policy_id: str or ~azure.mgmt.apimanagement.models.PolicyIdName
+ :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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_subscription_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_subscription_operations.py
new file mode 100644
index 000000000000..72d6fd12d049
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_subscription_operations.py
@@ -0,0 +1,1446 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, sid: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, sid: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ subscription_id: str,
+ *,
+ notify: Optional[bool] = None,
+ if_match: Optional[str] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if notify is not None:
+ _params["notify"] = _SERIALIZER.query("notify", notify, "bool")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+ if app_type is not None:
+ _params["appType"] = _SERIALIZER.query("app_type", app_type, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ notify: Optional[bool] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if notify is not None:
+ _params["notify"] = _SERIALIZER.query("notify", notify, "bool")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+ if app_type is not None:
+ _params["appType"] = _SERIALIZER.query("app_type", app_type, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_regenerate_primary_key_request(
+ resource_group_name: str, service_name: str, workspace_id: str, sid: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regeneratePrimaryKey",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_regenerate_secondary_key_request(
+ resource_group_name: str, service_name: str, workspace_id: str, sid: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regenerateSecondaryKey",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_list_secrets_request(
+ resource_group_name: str, service_name: str, workspace_id: str, sid: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/listSecrets",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceSubscriptionOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_subscription` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.SubscriptionContract"]:
+ """Lists all subscriptions of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || productId | filter | ge, le, eq, ne, gt, lt | substringof, contains,
+ startswith, endswith || state | filter | eq | || user | expand | |
+ |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either SubscriptionContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.SubscriptionContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.SubscriptionCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("SubscriptionCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, workspace_id: str, sid: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the apimanagement subscription specified by its
+ identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_tag_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, sid: str, **kwargs: Any
+ ) -> _models.SubscriptionContract:
+ """Gets the specified Subscription entity.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.SubscriptionContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("SubscriptionContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ parameters: _models.SubscriptionCreateParameters,
+ notify: Optional[bool] = None,
+ if_match: Optional[str] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.SubscriptionContract:
+ """Creates or updates the subscription of specified user to the specified product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionCreateParameters
+ :param notify: Notify change in Subscription State.
+
+
+ * If false, do not send any email notification for change of state of subscription
+ * If true, send email notification of change of state of subscription. Default value is None.
+ :type notify: bool
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ parameters: IO[bytes],
+ notify: Optional[bool] = None,
+ if_match: Optional[str] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.SubscriptionContract:
+ """Creates or updates the subscription of specified user to the specified product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param notify: Notify change in Subscription State.
+
+
+ * If false, do not send any email notification for change of state of subscription
+ * If true, send email notification of change of state of subscription. Default value is None.
+ :type notify: bool
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ parameters: Union[_models.SubscriptionCreateParameters, IO[bytes]],
+ notify: Optional[bool] = None,
+ if_match: Optional[str] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ **kwargs: Any
+ ) -> _models.SubscriptionContract:
+ """Creates or updates the subscription of specified user to the specified product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :param parameters: Create parameters. Is either a SubscriptionCreateParameters type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionCreateParameters or IO[bytes]
+ :param notify: Notify change in Subscription State.
+
+
+ * If false, do not send any email notification for change of state of subscription
+ * If true, send email notification of change of state of subscription. Default value is None.
+ :type notify: bool
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.SubscriptionContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "SubscriptionCreateParameters")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ notify=notify,
+ if_match=if_match,
+ app_type=app_type,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ if_match: str,
+ parameters: _models.SubscriptionUpdateParameters,
+ notify: Optional[bool] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.SubscriptionContract:
+ """Updates the details of a subscription specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: 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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionUpdateParameters
+ :param notify: Notify change in Subscription State.
+
+
+ * If false, do not send any email notification for change of state of subscription
+ * If true, send email notification of change of state of subscription. Default value is None.
+ :type notify: bool
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ if_match: str,
+ parameters: IO[bytes],
+ notify: Optional[bool] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.SubscriptionContract:
+ """Updates the details of a subscription specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: 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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :param notify: Notify change in Subscription State.
+
+
+ * If false, do not send any email notification for change of state of subscription
+ * If true, send email notification of change of state of subscription. Default value is None.
+ :type notify: bool
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ if_match: str,
+ parameters: Union[_models.SubscriptionUpdateParameters, IO[bytes]],
+ notify: Optional[bool] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ **kwargs: Any
+ ) -> _models.SubscriptionContract:
+ """Updates the details of a subscription specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: 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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a SubscriptionUpdateParameters type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionUpdateParameters or IO[bytes]
+ :param notify: Notify change in Subscription State.
+
+
+ * If false, do not send any email notification for change of state of subscription
+ * If true, send email notification of change of state of subscription. Default value is None.
+ :type notify: bool
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.SubscriptionContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "SubscriptionUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ notify=notify,
+ app_type=app_type,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("SubscriptionContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, workspace_id: str, sid: str, if_match: str, **kwargs: Any
+ ) -> None:
+ """Deletes the specified subscription.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: 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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
+
+ @distributed_trace
+ def regenerate_primary_key( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, workspace_id: str, sid: str, **kwargs: Any
+ ) -> None:
+ """Regenerates primary key of existing subscription of the workspace in an API Management service
+ instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_regenerate_primary_key_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+
+ @distributed_trace
+ def regenerate_secondary_key( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, workspace_id: str, sid: str, **kwargs: Any
+ ) -> None:
+ """Regenerates secondary key of existing subscription of the workspace in an API Management
+ service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_regenerate_secondary_key_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+
+ @distributed_trace
+ def list_secrets(
+ self, resource_group_name: str, service_name: str, workspace_id: str, sid: str, **kwargs: Any
+ ) -> _models.SubscriptionKeysContract:
+ """Gets the specified Subscription keys.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param sid: Subscription entity Identifier. The entity represents the association between a
+ user and a product in API Management. Required.
+ :type sid: str
+ :return: SubscriptionKeysContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionKeysContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.SubscriptionKeysContract] = kwargs.pop("cls", None)
+
+ _request = build_list_secrets_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("SubscriptionKeysContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_api_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_api_link_operations.py
new file mode 100644
index 000000000000..41666484bded
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_api_link_operations.py
@@ -0,0 +1,714 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_product_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
+ "apiLinkId": _SERIALIZER.url(
+ "api_link_id", api_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
+ "apiLinkId": _SERIALIZER.url(
+ "api_link_id", api_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
+ "apiLinkId": _SERIALIZER.url(
+ "api_link_id", api_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceTagApiLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_tag_api_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.TagApiLinkContract"]:
+ """Lists a collection of the API links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagApiLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagApiLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagApiLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Gets the API link for the tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagApiLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ parameters: _models.TagApiLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Adds an API to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Adds an API to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ parameters: Union[_models.TagApiLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.TagApiLinkContract:
+ """Adds an API to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :param parameters: Create or update parameters. Is either a TagApiLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagApiLinkContract or IO[bytes]
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagApiLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagApiLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified API from the specified tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param api_link_id: Tag-API link identifier. Must be unique in the current API Management
+ service instance. Required.
+ :type api_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_operation_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_operation_link_operations.py
new file mode 100644
index 000000000000..61aaf8b70c60
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_operation_link_operations.py
@@ -0,0 +1,715 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_product_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
+ "operationLinkId": _SERIALIZER.url(
+ "operation_link_id", operation_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
+ "operationLinkId": _SERIALIZER.url(
+ "operation_link_id", operation_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
+ "operationLinkId": _SERIALIZER.url(
+ "operation_link_id", operation_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceTagOperationLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_tag_operation_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.TagOperationLinkContract"]:
+ """Lists a collection of the operation links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| operationId
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either TagOperationLinkContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagOperationLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagOperationLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagOperationLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Gets the operation link for the tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagOperationLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagOperationLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ parameters: _models.TagOperationLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Adds an operation to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Adds an operation to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ parameters: Union[_models.TagOperationLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.TagOperationLinkContract:
+ """Adds an operation to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :param parameters: Create or update parameters. Is either a TagOperationLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagOperationLinkContract or IO[bytes]
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagOperationLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagOperationLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified operation from the specified tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param operation_link_id: Tag-operation link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_operations.py
new file mode 100644
index 000000000000..7768e254fea5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_operations.py
@@ -0,0 +1,1030 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ scope: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ if scope is not None:
+ _params["scope"] = _SERIALIZER.query("scope", scope, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_state_request(
+ resource_group_name: str, service_name: str, workspace_id: str, tag_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, tag_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceTagOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_tag` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ scope: Optional[str] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.TagContract"]:
+ """Lists a collection of tags defined within a workspace in a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param scope: Scope like 'apis', 'products' or 'apis/{apiId}. Default value is None.
+ :type scope: str
+ :return: An iterator like instance of either TagContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ 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,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ scope=scope,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get_entity_state(
+ self, resource_group_name: str, service_name: str, workspace_id: str, tag_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state version of the tag specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_get_entity_state_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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) # type: ignore
+ return 200 <= response.status_code <= 299
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, workspace_id: str, tag_id: str, **kwargs: Any
+ ) -> _models.TagContract:
+ """Gets the details of the tag specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ parameters: _models.TagCreateUpdateParameters,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagContract:
+ """Creates a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ parameters: IO[bytes],
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagContract:
+ """Creates a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param parameters: Create parameters. Required.
+ :type parameters: IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ parameters: Union[_models.TagCreateUpdateParameters, IO[bytes]],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.TagContract:
+ """Creates a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param parameters: Create parameters. Is either a TagCreateUpdateParameters type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO[bytes]
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagCreateUpdateParameters")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, 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.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ if_match: str,
+ parameters: _models.TagCreateUpdateParameters,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagContract:
+ """Updates the details of the tag specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ if_match: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagContract:
+ """Updates the details of the tag specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ if_match: str,
+ parameters: Union[_models.TagCreateUpdateParameters, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.TagContract:
+ """Updates the details of the tag specified by its identifier.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_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. Required.
+ :type if_match: str
+ :param parameters: Update parameters. Is either a TagCreateUpdateParameters type or a IO[bytes]
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO[bytes]
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagCreateUpdateParameters")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, workspace_id: str, tag_id: str, if_match: str, **kwargs: Any
+ ) -> None:
+ """Deletes specific tag of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_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. Required.
+ :type if_match: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_product_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_product_link_operations.py
new file mode 100644
index 000000000000..1892614df095
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_product_link_operations.py
@@ -0,0 +1,715 @@
+# pylint: disable=too-many-lines,too-many-statements
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from .._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_product_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ subscription_id: str,
+ *,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, 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: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
+ "productLinkId": _SERIALIZER.url(
+ "product_link_id", product_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
+ "productLinkId": _SERIALIZER.url(
+ "product_link_id", product_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "workspaceId": _SERIALIZER.url(
+ "workspace_id", workspace_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
+ "productLinkId": _SERIALIZER.url(
+ "product_link_id", product_link_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceTagProductLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_tag_product_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.TagProductLinkContract"]:
+ """Lists a collection of the product links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| productId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :return: An iterator like instance of either TagProductLinkContract or the result of
+ cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagProductLinkContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagProductLinkCollection] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_by_product_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ filter=filter,
+ top=top,
+ skip=skip,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._config.api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagProductLinkCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_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)
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Gets the product link for the tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.TagProductLinkContract] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_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("TagProductLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ parameters: _models.TagProductLinkContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Adds a product to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ parameters: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Adds a product to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :param parameters: Create or update parameters. Required.
+ :type parameters: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ parameters: Union[_models.TagProductLinkContract, IO[bytes]],
+ **kwargs: Any
+ ) -> _models.TagProductLinkContract:
+ """Adds a product to the specified tag via link.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :param parameters: Create or update parameters. Is either a TagProductLinkContract type or a
+ IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagProductLinkContract or IO[bytes]
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.TagProductLinkContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagProductLinkContract")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the specified product from the specified tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param product_link_id: Tag-product link identifier. Must be unique in the current API
+ Management service instance. Required.
+ :type product_link_id: str
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **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, {}) # type: ignore
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_all_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_all_policies.py
new file mode 100644
index 000000000000..b86f46891c19
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_all_policies.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_all_policies.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.all_policies.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementAllPolicies.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_apply_network_configuration_updates.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_apply_network_configuration_updates.py
index 3dd87af23d74..d2c4cf17fa0a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_apply_network_configuration_updates.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_apply_network_configuration_updates.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_apply_network_configuration_updates(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementApplyNetworkConfigurationUpdates.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementApplyNetworkConfigurationUpdates.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_approve_or_reject_private_endpoint_connection.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_approve_or_reject_private_endpoint_connection.py
index 47ca9ebf4adc..01982fb7cdfa 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_approve_or_reject_private_endpoint_connection.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_approve_or_reject_private_endpoint_connection.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.private_endpoint_connection.begin_create_or_update(
@@ -37,7 +35,7 @@ def main():
service_name="apimService1",
private_endpoint_connection_name="privateEndpointConnectionName",
private_endpoint_connection_request={
- "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/connectionName",
+ "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/connectionName",
"properties": {
"privateLinkServiceConnectionState": {
"description": "The Private Endpoint Connection is approved.",
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementApproveOrRejectPrivateEndpointConnection.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementApproveOrRejectPrivateEndpointConnection.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_authorization_server_list_secrets.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_authorization_server_list_secrets.py
index 66aa19d8682e..770dd75dec12 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_authorization_server_list_secrets.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_authorization_server_list_secrets.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_server.list_secrets(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementAuthorizationServerListSecrets.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementAuthorizationServerListSecrets.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backend_reconnect.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backend_reconnect.py
index 2dcfc0d108c7..29fc52ed45e9 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backend_reconnect.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backend_reconnect.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.backend.reconnect(
@@ -37,6 +37,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementBackendReconnect.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementBackendReconnect.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_access_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_access_key.py
index 2a0e5cb7f855..de23276b216a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_access_key.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_access_key.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_backup(
@@ -46,6 +44,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementBackupWithAccessKey.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementBackupWithAccessKey.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_system_managed_identity.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_system_managed_identity.py
index bed66ff2c560..72f62a365f9a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_system_managed_identity.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_system_managed_identity.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_backup(
@@ -45,6 +43,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementBackupWithSystemManagedIdentity.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementBackupWithSystemManagedIdentity.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_user_assigned_managed_identity.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_user_assigned_managed_identity.py
index c3217f2487a4..dd47c292fcea 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_user_assigned_managed_identity.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_backup_with_user_assigned_managed_identity.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_backup(
@@ -46,6 +44,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementBackupWithUserAssignedManagedIdentity.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementBackupWithUserAssignedManagedIdentity.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_ai_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_ai_logger.py
index ebafe51242ac..04f74a750c74 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_ai_logger.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_ai_logger.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.logger.create_or_update(
@@ -47,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateAILogger.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateAILogger.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api.py
index 795f6a7a9f36..856bb1a40b7f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -53,6 +51,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_clone.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_clone.py
index 8ecf84be3b5f..61eba6709fa4 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_clone.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_clone.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -44,7 +42,7 @@ def main():
"path": "echo2",
"protocols": ["http", "https"],
"serviceUrl": "http://echoapi.cloudapp.net/api",
- "sourceApiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58a4aeac497000007d040001",
+ "sourceApiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58a4aeac497000007d040001",
"subscriptionRequired": True,
}
},
@@ -52,6 +50,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiClone.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiClone.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_diagnostic.py
index 148ac7bb73e5..e3c589da34e0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_diagnostic.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_diagnostic.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_diagnostic.create_or_update(
@@ -56,6 +54,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiDiagnostic.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiDiagnostic.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue.py
index 78a56e2e35bf..1ee3d37037a1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue.create_or_update(
@@ -43,13 +41,13 @@ def main():
"description": "New API issue description",
"state": "open",
"title": "New API issue",
- "userId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1",
+ "userId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1",
}
},
)
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiIssue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiIssue.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_attachment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_attachment.py
index 1d528b578d09..eeb81a3a94e3 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_attachment.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_attachment.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_attachment.create_or_update(
@@ -45,6 +43,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiIssueAttachment.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiIssueAttachment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_comment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_comment.py
index c5c99039fd71..7544e2297d05 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_comment.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_issue_comment.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_comment.create_or_update(
@@ -42,13 +40,13 @@ def main():
"properties": {
"createdDate": "2018-02-01T22:21:20.467Z",
"text": "Issue comment.",
- "userId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1",
+ "userId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1",
}
},
)
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiIssueComment.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiIssueComment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_new_version_using_existing_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_new_version_using_existing_api.py
index 77914e3d2027..28a5820a3915 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_new_version_using_existing_api.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_new_version_using_existing_api.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -39,14 +37,14 @@ def main():
parameters={
"properties": {
"apiVersion": "v4",
- "apiVersionSetId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458",
+ "apiVersionSetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458",
"description": "Create Echo API into a new Version using Existing Version Set and Copy all Operations.",
"displayName": "Echo API2",
"isCurrent": True,
"path": "echo2",
"protocols": ["http", "https"],
"serviceUrl": "http://echoapi.cloudapp.net/api",
- "sourceApiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoPath",
+ "sourceApiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoPath",
"subscriptionRequired": True,
}
},
@@ -54,6 +52,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiNewVersionUsingExistingApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiNewVersionUsingExistingApi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation.py
index 7137883ca85c..7d102d43ec70 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation.create_or_update(
@@ -66,6 +64,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiOperation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiOperation.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_policy.py
index 97c283a58f4b..4bfa7c4f38aa 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation_policy.create_or_update(
@@ -51,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiOperationPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiOperationPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_tag.py
index 0e47cfe4e3a0..28793a80c7b8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_operation_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.assign_to_operation(
@@ -40,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiOperationTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiOperationTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy.py
index 22bfabc0fc73..2cfd4d04d7d6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_policy.create_or_update(
@@ -50,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy_non_xml_encoded.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy_non_xml_encoded.py
index d10697303280..a72879004336 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy_non_xml_encoded.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_policy_non_xml_encoded.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_policy.create_or_update(
@@ -50,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiPolicyNonXmlEncoded.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiPolicyNonXmlEncoded.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_release.py
index c2b5ac57b9e2..678ad27481d6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_release.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_release.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_release.create_or_update(
@@ -39,7 +37,7 @@ def main():
release_id="testrev",
parameters={
"properties": {
- "apiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1",
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1",
"notes": "yahooagain",
}
},
@@ -47,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiRelease.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiRelease.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_revision_from_existing_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_revision_from_existing_api.py
index 58df746c5359..b99412cad44b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_revision_from_existing_api.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_revision_from_existing_api.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -41,13 +39,13 @@ def main():
"apiRevisionDescription": "Creating a Revision of an existing API",
"path": "echo",
"serviceUrl": "http://echoapi.cloudapp.net/apiv3",
- "sourceApiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api",
+ "sourceApiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api",
}
},
).result()
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiRevisionFromExistingApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiRevisionFromExistingApi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_schema.py
index 29fe682f3055..728b33437f23 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_schema.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_schema.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_schema.begin_create_or_update(
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiSchema.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiSchema.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag.py
index fbffafe62d06..81ae179a9c94 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.assign_to_api(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag_description.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag_description.py
index a53a6dc09db6..6071ce05c203 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag_description.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_tag_description.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_tag_description.create_or_update(
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiTagDescription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiTagDescription.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_import_override_service_url.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_import_override_service_url.py
index 573cda6ddc9a..c330f57331be 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_import_override_service_url.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_import_override_service_url.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingImportOverrideServiceUrl.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiUsingImportOverrideServiceUrl.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import.py
index 9f7e66fca83c..0d072273142d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -47,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingOai3Import.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiUsingOai3Import.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import_with_translate_required_query_parameters_conduct.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import_with_translate_required_query_parameters_conduct.py
index 9247b88dc12f..eabba6b4433e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import_with_translate_required_query_parameters_conduct.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_oai3_import_with_translate_required_query_parameters_conduct.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_swagger_import.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_swagger_import.py
index fd65860c4854..cc1c571e3edc 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_swagger_import.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_swagger_import.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -47,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingSwaggerImport.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiUsingSwaggerImport.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_wadl_import.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_wadl_import.py
index be5f77a74676..6cd4e4021604 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_wadl_import.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_using_wadl_import.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -47,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingWadlImport.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiUsingWadlImport.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_version_set.py
index f264ccbe9e72..4e9314b6bcbd 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_version_set.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_version_set.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_version_set.create_or_update(
@@ -47,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiVersionSet.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiVersionSet.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_wiki.py
index f75af9e56666..6409999de1c0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_wiki.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_wiki.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_wiki.create_or_update(
@@ -41,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWiki.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiWiki.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_auth_servers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_auth_servers.py
index f7aa7e312144..be9efd7e70de 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_auth_servers.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_auth_servers.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -56,6 +54,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithMultipleAuthServers.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiWithMultipleAuthServers.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_open_id_connect_providers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_open_id_connect_providers.py
index 51baf16fb1fe..70be70839263 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_open_id_connect_providers.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_multiple_open_id_connect_providers.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -62,6 +60,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithMultipleOpenIdConnectProviders.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiWithMultipleOpenIdConnectProviders.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_open_id_connect.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_open_id_connect.py
index 00ff26bb0787..88eae8491bdf 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_open_id_connect.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_api_with_open_id_connect.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -53,6 +51,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithOpenIdConnect.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateApiWithOpenIdConnect.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_auth_code.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_auth_code.py
index c0e9c7775080..a2f3182e732a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_auth_code.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_auth_code.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization.create_or_update(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateAuthorizationAADAuthCode.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateAuthorizationAADAuthCode.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_client_cred.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_client_cred.py
index 136424336e69..04df4e428445 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_client_cred.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_aad_client_cred.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization.create_or_update(
@@ -41,16 +39,13 @@ def main():
"properties": {
"authorizationType": "OAuth2",
"oauth2grantType": "AuthorizationCode",
- "parameters": {
- "clientId": "53790925-fdd3-4b80-bc7a-4c3aaf25801d",
- "clientSecret": "xxxxxxxxxxxxxxx~xxxxxxxxx",
- },
+ "parameters": {"clientId": "clientsecretid", "clientSecret": "clientsecretvalue"},
}
},
)
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateAuthorizationAADClientCred.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateAuthorizationAADClientCred.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_access_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_access_policy.py
index e2ef181923a8..b6802e5749c0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_access_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_access_policy.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_access_policy.create_or_update(
@@ -40,6 +38,7 @@ def main():
authorization_access_policy_id="fe0bed83-631f-4149-bd0b-0464b1bc7cab",
parameters={
"properties": {
+ "appIds": ["d5f04bb0-ba78-4878-a43e-35a0b74fe315"],
"objectId": "fe0bed83-631f-4149-bd0b-0464b1bc7cab",
"tenantId": "13932a0d-5c63-4d37-901d-1df9c97722ff",
}
@@ -48,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateAuthorizationAccessPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateAuthorizationAccessPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_auth_code.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_auth_code.py
index 5e207b22cc50..9576f2fce515 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_auth_code.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_auth_code.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_provider.create_or_update(
@@ -43,8 +41,8 @@ def main():
"oauth2": {
"grantTypes": {
"authorizationCode": {
- "clientId": "59790825-fdd3-4b10-bc7a-4c3aaf25801d",
- "clientSecret": "xxxxxxxxxxxxxxxxxxxxxxxx",
+ "clientId": "clientsecretid",
+ "clientSecret": "clientsecretvalue",
"resourceUri": "https://graph.microsoft.com",
"scopes": "User.Read.All Group.Read.All",
}
@@ -57,6 +55,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateAuthorizationProviderAADAuthCode.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateAuthorizationProviderAADAuthCode.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_client_cred.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_client_cred.py
index 75087d593c76..1d6de9fd05de 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_client_cred.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_aad_client_cred.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_provider.create_or_update(
@@ -55,6 +53,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateAuthorizationProviderAADClientCred.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateAuthorizationProviderAADClientCred.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_generic_oauth2.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_generic_oauth2.py
index 300ff958185e..ca9eea5d77d9 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_generic_oauth2.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_generic_oauth2.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_provider.create_or_update(
@@ -44,10 +42,10 @@ def main():
"grantTypes": {
"authorizationCode": {
"authorizationUrl": "https://www.eventbrite.com/oauth/authorize",
- "clientId": "genericClientId",
- "clientSecret": "xxxxxxxxxxxxxxxxxxxxxxxx",
+ "clientId": "clientid",
+ "clientSecret": "clientsecretvalue",
"refreshUrl": "https://www.eventbrite.com/oauth/token",
- "scopes": "",
+ "scopes": None,
"tokenUrl": "https://www.eventbrite.com/oauth/token",
}
},
@@ -59,6 +57,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateAuthorizationProviderGenericOAuth2.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateAuthorizationProviderGenericOAuth2.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_oob_google.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_oob_google.py
index 5007f303c727..659956d9e7fe 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_oob_google.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_provider_oob_google.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_provider.create_or_update(
@@ -43,8 +41,8 @@ def main():
"oauth2": {
"grantTypes": {
"authorizationCode": {
- "clientId": "99999999-xxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
- "clientSecret": "XXXXXXXXXXXXXXXXXXXX",
+ "clientId": "99999999-xxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
+ "clientSecret": "clientsecretvalue",
"scopes": "openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
}
},
@@ -56,6 +54,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateAuthorizationProviderOOBGoogle.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateAuthorizationProviderOOBGoogle.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_server.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_server.py
index db604163bb16..ca0e96b06b12 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_server.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_authorization_server.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_server.create_or_update(
@@ -60,6 +58,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateAuthorizationServer.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateAuthorizationServer.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_proxy_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_proxy_backend.py
index 39eea9a2a057..060435849df9 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_proxy_backend.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_proxy_backend.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.backend.create_or_update(
@@ -54,6 +52,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateBackendProxyBackend.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateBackendProxyBackend.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_service_fabric.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_service_fabric.py
index 4b2dd41b87f0..31036046ee61 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_service_fabric.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_backend_service_fabric.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.backend.create_or_update(
@@ -41,7 +39,7 @@ def main():
"description": "Service Fabric Test App 1",
"properties": {
"serviceFabricCluster": {
- "clientCertificateId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1",
+ "clientCertificateId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1",
"managementEndpoints": ["https://somecluster.com"],
"maxPartitionResolutionRetries": 5,
"serverX509Names": [
@@ -57,6 +55,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateBackendServiceFabric.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateBackendServiceFabric.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_cache.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_cache.py
index 51734b97c986..e2b771960e55 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_cache.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_cache.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.cache.create_or_update(
@@ -40,7 +38,7 @@ def main():
"properties": {
"connectionString": "apim.redis.cache.windows.net:6380,password=xc,ssl=True,abortConnect=False",
"description": "Redis cache instances in West India",
- "resourceId": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redis/apimservice1",
+ "resourceId": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Cache/redis/apimservice1",
"useFromLocation": "default",
}
},
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateCache.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateCache.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate.py
index 3c4fc86ef3a3..40fb477a24e0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.certificate.create_or_update(
@@ -46,6 +44,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateCertificate.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateCertificate.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate_with_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate_with_key_vault.py
index a62ba4b93a0d..df2a4e04e224 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate_with_key_vault.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_certificate_with_key_vault.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.certificate.create_or_update(
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateCertificateWithKeyVault.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateCertificateWithKeyVault.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type.py
index 2f753eb79280..a60121540fe3 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_type.create_or_update(
@@ -88,6 +86,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateContentType.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateContentType.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type_content_item.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type_content_item.py
index 42a5cd2f1691..030bb783a25e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type_content_item.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_content_type_content_item.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_item.create_or_update(
@@ -52,6 +50,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateContentTypeContentItem.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateContentTypeContentItem.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_diagnostic.py
index 92bb01ecec29..c020f79a8617 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_diagnostic.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_diagnostic.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.diagnostic.create_or_update(
@@ -55,6 +53,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateDiagnostic.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateDiagnostic.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_documentation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_documentation.py
index 4058eddc8001..f2d1d167306d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_documentation.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_documentation.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.documentation.create_or_update(
@@ -41,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateDocumentation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateDocumentation.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_eh_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_eh_logger.py
index 018bab238e06..576cbb12d044 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_eh_logger.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_eh_logger.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.logger.create_or_update(
@@ -50,6 +48,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateEHLogger.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateEHLogger.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway.py
index ce4bd494c43e..acacf15e48a1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway.create_or_update(
@@ -41,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGateway.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateGateway.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_api.py
index da3fb7e85279..f376993b71eb 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_api.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_api.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_api.create_or_update(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGatewayApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateGatewayApi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_certificate_authority.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_certificate_authority.py
index 033b67a01dbc..62a28c48e709 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_certificate_authority.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_certificate_authority.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_certificate_authority.create_or_update(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGatewayCertificateAuthority.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateGatewayCertificateAuthority.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_config_connection.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_config_connection.py
new file mode 100644
index 000000000000..0d1107be9854
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_config_connection.py
@@ -0,0 +1,48 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_gateway_config_connection.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_gateway_config_connection.begin_create_or_update(
+ resource_group_name="rg1",
+ gateway_name="standard-gw-01",
+ config_connection_name="gcc-01",
+ parameters={
+ "properties": {
+ "sourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/services/apim-service-1/workspaces/ws-001"
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateGatewayConfigConnection.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_hostname_configuration.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_hostname_configuration.py
index eece8c385720..9ef1eb231e6a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_hostname_configuration.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_gateway_hostname_configuration.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_hostname_configuration.create_or_update(
@@ -39,7 +37,7 @@ def main():
hc_id="default",
parameters={
"properties": {
- "certificateId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1",
+ "certificateId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1",
"hostname": "*",
"http2Enabled": True,
"negotiateClientCertificate": False,
@@ -51,6 +49,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGatewayHostnameConfiguration.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateGatewayHostnameConfiguration.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema1.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema1.py
index 1f7d05d80c1b..94c087b37440 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema1.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema1.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.global_schema.begin_create_or_update(
@@ -47,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGlobalSchema1.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateGlobalSchema1.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema2.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema2.py
index 96809f390c32..6b01e60c9b75 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema2.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_global_schema2.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.global_schema.begin_create_or_update(
@@ -61,6 +59,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGlobalSchema2.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateGlobalSchema2.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api.py
index d214e403ae76..948683aac1db 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -50,6 +48,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGraphQLApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateGraphQLApi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver.py
index 49b10ccb4f89..70363a88a68f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver.create_or_update(
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGraphQLApiResolver.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateGraphQLApiResolver.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver_policy.py
index b27e995c94ce..053bb29c1fd0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_graph_ql_api_resolver_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver_policy.create_or_update(
@@ -51,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGraphQLApiResolverPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateGraphQLApiResolverPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group.py
index 394831375be3..2123d0d5ddd6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group.create_or_update(
@@ -41,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGroup.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_external.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_external.py
index fa8592dfe0b7..4d147dfdb574 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_external.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_external.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group.create_or_update(
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGroupExternal.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateGroupExternal.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_user.py
index e4d9d1725e86..a357c8a9601f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_user.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_group_user.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group_user.create(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGroupUser.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateGroupUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_grpc_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_grpc_api.py
new file mode 100644
index 000000000000..f4b23877fb7b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_grpc_api.py
@@ -0,0 +1,55 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_grpc_api.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ api_id="tempgroup",
+ parameters={
+ "properties": {
+ "description": "apidescription5200",
+ "displayName": "apiname1463",
+ "format": "grpc-link",
+ "path": "grpc-api",
+ "protocols": ["https"],
+ "serviceUrl": "https://your-api-hostname/samples",
+ "type": "grpc",
+ "value": "https://raw.githubusercontent.com/kedacore/keda/main/pkg/scalers/externalscaler/externalscaler.proto",
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateGrpcApi.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_identity_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_identity_provider.py
index 02fb426e3a99..1ecbf737ee1b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_identity_provider.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_identity_provider.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.identity_provider.create_or_update(
@@ -44,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateIdentityProvider.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateIdentityProvider.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_multi_region_service_with_custom_hostname.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_multi_region_service_with_custom_hostname.py
index 23a8c0811874..d2a5dab9277b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_multi_region_service_with_custom_hostname.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_multi_region_service_with_custom_hostname.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -62,6 +60,12 @@ def main():
"hostName": "portal1.msitesting.net",
"type": "Portal",
},
+ {
+ "certificatePassword": "Password",
+ "encodedCertificate": "****** Base 64 Encoded Certificate ************",
+ "hostName": "configuration-api.msitesting.net",
+ "type": "ConfigurationApi",
+ },
],
"publisherEmail": "apim@autorestsdk.com",
"publisherName": "autorestsdk",
@@ -74,6 +78,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateMultiRegionServiceWithCustomHostname.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateMultiRegionServiceWithCustomHostname.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value.py
index 25fbae15022b..7ec83ad9cc3b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.begin_create_or_update(
@@ -43,6 +41,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateNamedValue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateNamedValue.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value_with_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value_with_key_vault.py
index c75554f95b94..843de5e0fbd5 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value_with_key_vault.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_named_value_with_key_vault.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.begin_create_or_update(
@@ -51,6 +49,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateNamedValueWithKeyVault.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateNamedValueWithKeyVault.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification.py
index c4e43113a3dd..9f67b516c33b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification.create_or_update(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateNotification.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateNotification.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_email.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_email.py
index e4eda87dd062..7f5e8ee6f4fc 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_email.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_email.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification_recipient_email.create_or_update(
@@ -44,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateNotificationRecipientEmail.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateNotificationRecipientEmail.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_user.py
index 42b92682dba5..db661129b7e8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_user.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_notification_recipient_user.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification_recipient_user.create_or_update(
@@ -44,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateNotificationRecipientUser.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateNotificationRecipientUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_odata_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_odata_api.py
new file mode 100644
index 000000000000..f30504946b62
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_odata_api.py
@@ -0,0 +1,55 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_odata_api.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ api_id="tempgroup",
+ parameters={
+ "properties": {
+ "description": "apidescription5200",
+ "displayName": "apiname1463",
+ "format": "odata-link",
+ "path": "odata-api",
+ "protocols": ["http", "https"],
+ "serviceUrl": "https://services.odata.org/TripPinWebApiService",
+ "type": "odata",
+ "value": "https://services.odata.org/TripPinWebApiService/$metadata",
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateODataApi.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_open_id_connect_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_open_id_connect_provider.py
index 90ec5c3aa56d..a17d8d966f86 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_open_id_connect_provider.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_open_id_connect_provider.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.open_id_connect_provider.create_or_update(
@@ -50,6 +48,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateOpenIdConnectProvider.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateOpenIdConnectProvider.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy.py
index 8b05fc576fd4..6ebfbe3e3de1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy.create_or_update(
@@ -49,6 +44,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreatePolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreatePolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_fragment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_fragment.py
index dd9c1ea7e4d7..6d452b23d296 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_fragment.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_fragment.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy_fragment.begin_create_or_update(
@@ -47,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreatePolicyFragment.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreatePolicyFragment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_restriction.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_restriction.py
new file mode 100644
index 000000000000..f9d0ad4c2dd2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_restriction.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_policy_restriction.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.policy_restriction.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ policy_restriction_id="policyRestriction1",
+ parameters={"properties": {"requireBase": "true", "scope": "Sample Path to the policy document."}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreatePolicyRestriction.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_config.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_config.py
index b34cd16c6f33..4b1cc21fc377 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_config.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_config.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_config.create_or_update(
@@ -62,6 +60,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreatePortalConfig.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreatePortalConfig.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_revision.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_revision.py
index f108ebed3134..ee60eeb6ebc9 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_revision.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_revision.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_revision.begin_create_or_update(
@@ -41,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreatePortalRevision.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreatePortalRevision.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product.py
index 144d8a3dbde2..a3d386a14da6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product.create_or_update(
@@ -41,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateProduct.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateProduct.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_api.py
index e9c7583d42ae..76b59631717a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_api.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_api.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_api.create_or_update(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateProductApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateProductApi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_api_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_api_link.py
new file mode 100644
index 000000000000..3291dadfd3f1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_api_link.py
@@ -0,0 +1,49 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_product_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.product_api_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ product_id="testproduct",
+ api_link_id="link1",
+ parameters={
+ "properties": {
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateProductApiLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_group.py
index 1713e706cb8d..6fc10dc2704b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_group.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_group.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_group.create_or_update(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateProductGroup.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateProductGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_group_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_group_link.py
new file mode 100644
index 000000000000..4395f922a6cd
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_group_link.py
@@ -0,0 +1,49 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_product_group_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.product_group_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ product_id="testproduct",
+ group_link_id="link1",
+ parameters={
+ "properties": {
+ "groupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/group1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateProductGroupLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_policy.py
index 52bbc31e8a6e..632e0c84c13a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_policy.create_or_update(
@@ -50,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateProductPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateProductPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_tag.py
index 07ab1d31f2f6..958a8960f766 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.assign_to_product(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateProductTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateProductTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_wiki.py
index 48a8254322a0..fb7af0c9bd4d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_wiki.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_wiki.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_wiki.create_or_update(
@@ -41,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateProductWiki.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateProductWiki.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service.py
index 988fb15918db..a8b7e055c75a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -45,6 +43,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateService.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateService.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_having_msi.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_having_msi.py
index 533d7cd1955e..d86140705c72 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_having_msi.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_having_msi.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -46,6 +44,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateServiceHavingMsi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateServiceHavingMsi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_vnet_with_public_ip.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_vnet_with_public_ip.py
index d51b010977a2..96f67a39d25d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_vnet_with_public_ip.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_vnet_with_public_ip.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -38,11 +36,11 @@ def main():
parameters={
"location": "East US 2 EUAP",
"properties": {
- "publicIpAddressId": "/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.Network/publicIPAddresses/apimazvnet",
+ "publicIpAddressId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgName/providers/Microsoft.Network/publicIPAddresses/apimazvnet",
"publisherEmail": "apim@autorestsdk.com",
"publisherName": "autorestsdk",
"virtualNetworkConfiguration": {
- "subnetResourceId": "/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.Network/virtualNetworks/apimcus/subnets/tenant"
+ "subnetResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgName/providers/Microsoft.Network/virtualNetworks/apimcus/subnets/tenant"
},
"virtualNetworkType": "External",
},
@@ -54,6 +52,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateServiceInVnetWithPublicIP.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateServiceInVnetWithPublicIP.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_zones.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_zones.py
index 1b1b5135affe..dabcb85627f6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_zones.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_in_zones.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -46,6 +44,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateServiceInZones.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateServiceInZones.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_skuv2_service.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_skuv2_service.py
new file mode 100644
index 000000000000..a24f7b79008b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_skuv2_service.py
@@ -0,0 +1,49 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_service_skuv2_service.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_management_service.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ parameters={
+ "identity": {"type": "SystemAssigned"},
+ "location": "West US",
+ "properties": {"publisherEmail": "apim@autorestsdk.com", "publisherName": "autorestsdk"},
+ "sku": {"capacity": 1, "name": "StandardV2"},
+ "tags": {"tag1": "value1", "tag2": "value2", "tag3": "value3"},
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateServiceSkuv2Service.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_custom_hostname_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_custom_hostname_key_vault.py
index 4bb51386bf8e..cafdbb500af0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_custom_hostname_key_vault.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_custom_hostname_key_vault.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -39,7 +37,7 @@ def main():
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
- "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}
+ "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}
},
},
"location": "North Europe",
@@ -65,6 +63,12 @@ def main():
"keyVaultId": "https://rpbvtkeyvaultintegration.vault.azure.net/secrets/msitestingCert",
"type": "Portal",
},
+ {
+ "certificatePassword": "Password",
+ "encodedCertificate": "****** Base 64 Encoded Certificate ************",
+ "hostName": "configuration-api.msitesting.net",
+ "type": "ConfigurationApi",
+ },
],
"publisherEmail": "apim@autorestsdk.com",
"publisherName": "autorestsdk",
@@ -77,6 +81,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateServiceWithCustomHostnameKeyVault.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateServiceWithCustomHostnameKeyVault.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_developer_portal.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_developer_portal.py
new file mode 100644
index 000000000000..73db20b4047e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_developer_portal.py
@@ -0,0 +1,52 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_service_with_developer_portal.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_management_service.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ parameters={
+ "location": "South Central US",
+ "properties": {
+ "developerPortalStatus": "Enabled",
+ "publisherEmail": "foo@contoso.com",
+ "publisherName": "foo",
+ },
+ "sku": {"capacity": 1, "name": "Developer"},
+ "tags": {"Name": "Contoso", "Test": "User"},
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateServiceWithDeveloperPortal.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_nat_gateway_enabled.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_nat_gateway_enabled.py
index 1448415d9754..92dac8218298 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_nat_gateway_enabled.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_nat_gateway_enabled.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateServiceWithNatGatewayEnabled.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateServiceWithNatGatewayEnabled.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_system_certificates.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_system_certificates.py
index d63975a51d7e..1bfbf583102f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_system_certificates.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_system_certificates.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -55,6 +53,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateServiceWithSystemCertificates.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateServiceWithSystemCertificates.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_user_assigned_identity.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_user_assigned_identity.py
index 83f973b85a7a..ce84dc9d3a62 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_user_assigned_identity.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_user_assigned_identity.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -39,7 +37,7 @@ def main():
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
- "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/apimService1": {}
+ "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/apimService1": {}
},
},
"location": "West US",
@@ -51,6 +49,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateServiceWithUserAssignedIdentity.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateServiceWithUserAssignedIdentity.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_without_legacy_configuration_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_without_legacy_configuration_api.py
new file mode 100644
index 000000000000..da2cda3d74be
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_without_legacy_configuration_api.py
@@ -0,0 +1,52 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_service_without_legacy_configuration_api.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_management_service.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ parameters={
+ "location": "Central US",
+ "properties": {
+ "configurationApi": {"legacyApi": "Disabled"},
+ "publisherEmail": "apim@autorestsdk.com",
+ "publisherName": "autorestsdk",
+ },
+ "sku": {"capacity": 1, "name": "Basic"},
+ "tags": {"tag1": "value1", "tag2": "value2", "tag3": "value3"},
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateServiceWithoutLegacyConfigurationApi.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_pass_through_api_using_wsdl_import.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_pass_through_api_using_wsdl_import.py
index 251633f4860c..d35097b14061 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_pass_through_api_using_wsdl_import.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_pass_through_api_using_wsdl_import.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateSoapPassThroughApiUsingWsdlImport.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateSoapPassThroughApiUsingWsdlImport.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_to_rest_api_using_wsdl_import.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_to_rest_api_using_wsdl_import.py
index 7694e79ac435..2816e42f4029 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_to_rest_api_using_wsdl_import.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_to_rest_api_using_wsdl_import.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateSoapToRestApiUsingWsdlImport.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateSoapToRestApiUsingWsdlImport.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_standard_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_standard_gateway.py
new file mode 100644
index 000000000000..44dd1c2b6348
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_standard_gateway.py
@@ -0,0 +1,54 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_standard_gateway.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_gateway.begin_create_or_update(
+ resource_group_name="rg1",
+ gateway_name="apimGateway1",
+ parameters={
+ "location": "South Central US",
+ "properties": {
+ "backend": {
+ "subnet": {
+ "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vn1/subnets/sn1"
+ }
+ }
+ },
+ "sku": {"capacity": 1, "name": "Standard"},
+ "tags": {"Name": "Contoso", "Test": "User"},
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateStandardGateway.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_subscription.py
index 92571e820f8b..b1a6a015dcfa 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_subscription.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_subscription.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.subscription.create_or_update(
@@ -39,14 +37,14 @@ def main():
parameters={
"properties": {
"displayName": "testsub",
- "ownerId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7",
- "scope": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002",
+ "ownerId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7",
+ "scope": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002",
}
},
)
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateSubscription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateSubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag.py
index 25e575987f49..6bc0ca40a1d5 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.create_or_update(
@@ -41,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag_api_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag_api_link.py
new file mode 100644
index 000000000000..6ad9f693dd3e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag_api_link.py
@@ -0,0 +1,49 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_tag_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_api_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ api_link_id="link1",
+ parameters={
+ "properties": {
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateTagApiLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag_operation_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag_operation_link.py
new file mode 100644
index 000000000000..bdc55f233e11
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag_operation_link.py
@@ -0,0 +1,49 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_tag_operation_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_operation_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ operation_link_id="link1",
+ parameters={
+ "properties": {
+ "operationId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api/operations/op1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateTagOperationLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag_product_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag_product_link.py
new file mode 100644
index 000000000000..81ed0fbc17b0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag_product_link.py
@@ -0,0 +1,49 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_tag_product_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_product_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ product_link_id="link1",
+ parameters={
+ "properties": {
+ "productId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/product1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateTagProductLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_template.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_template.py
index 6b2a883b22ce..0db4822c4d8f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_template.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_template.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.email_template.create_or_update(
@@ -44,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateTemplate.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateTemplate.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tenant_access.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tenant_access.py
index a2a4ed6d5c41..a057ecdc6a55 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tenant_access.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tenant_access.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_access.create(
@@ -45,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateTenantAccess.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateTenantAccess.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_user.py
index c131f88e7621..1be997f85116 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_user.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_user.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user.create_or_update(
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateUser.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_websocket_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_websocket_api.py
index a4d2d45e9c3a..351a1203d093 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_websocket_api.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_websocket_api.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -50,6 +48,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateWebsocketApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWebsocketApi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace.py
new file mode 100644
index 000000000000..bc73e6d50b54
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ parameters={"properties": {"description": "workspace 1", "displayName": "my workspace"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspace.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_ai_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_ai_logger.py
new file mode 100644
index 000000000000..9e0490493d88
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_ai_logger.py
@@ -0,0 +1,51 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_ai_logger.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_logger.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ logger_id="loggerId",
+ parameters={
+ "properties": {
+ "credentials": {"instrumentationKey": "11................a1"},
+ "description": "adding a new logger",
+ "loggerType": "applicationInsights",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceAILogger.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api.py
new file mode 100644
index 000000000000..7290ae92cc18
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api.py
@@ -0,0 +1,57 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_api.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="tempgroup",
+ parameters={
+ "properties": {
+ "authenticationSettings": {
+ "oAuth2": {"authorizationServerId": "authorizationServerId2283", "scope": "oauth2scope2580"}
+ },
+ "description": "apidescription5200",
+ "displayName": "apiname1463",
+ "path": "newapiPath",
+ "protocols": ["https", "http"],
+ "serviceUrl": "http://newechoapi.cloudapp.net/api",
+ "subscriptionKeyParameterNames": {"header": "header4520", "query": "query3037"},
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceApi.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_diagnostic.py
new file mode 100644
index 000000000000..f0111c98ca22
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_diagnostic.py
@@ -0,0 +1,60 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_api_diagnostic.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_diagnostic.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d1f7558aa04f15146d9d8a",
+ diagnostic_id="applicationinsights",
+ parameters={
+ "properties": {
+ "alwaysLog": "allErrors",
+ "backend": {
+ "request": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ "response": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ },
+ "frontend": {
+ "request": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ "response": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ },
+ "loggerId": "/workspaces/wks1/loggers/applicationinsights",
+ "sampling": {"percentage": 50, "samplingType": "fixed"},
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceApiDiagnostic.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_operation.py
new file mode 100644
index 000000000000..26a325ec9559
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_operation.py
@@ -0,0 +1,70 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_api_operation.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="PetStoreTemplate2",
+ operation_id="newoperations",
+ parameters={
+ "properties": {
+ "description": "This can only be done by the logged in user.",
+ "displayName": "createUser2",
+ "method": "POST",
+ "request": {
+ "description": "Created user object",
+ "headers": [],
+ "queryParameters": [],
+ "representations": [
+ {"contentType": "application/json", "schemaId": "592f6c1d0af5840ca8897f0c", "typeName": "User"}
+ ],
+ },
+ "responses": [
+ {
+ "description": "successful operation",
+ "headers": [],
+ "representations": [{"contentType": "application/xml"}, {"contentType": "application/json"}],
+ "statusCode": 200,
+ }
+ ],
+ "templateParameters": [],
+ "urlTemplate": "/user1",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceApiOperation.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_operation_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_operation_policy.py
new file mode 100644
index 000000000000..e1c1c0a9cb54
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_operation_policy.py
@@ -0,0 +1,52 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_api_operation_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation_policy.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5600b57e7e8880006a040001",
+ operation_id="5600b57e7e8880006a080001",
+ policy_id="policy",
+ parameters={
+ "properties": {
+ "format": "xml",
+ "value": " ",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceApiOperationPolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_policy.py
new file mode 100644
index 000000000000..637d523394c3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_policy.py
@@ -0,0 +1,51 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_api_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_policy.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5600b57e7e8880006a040001",
+ policy_id="policy",
+ parameters={
+ "properties": {
+ "format": "xml",
+ "value": " ",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceApiPolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_release.py
new file mode 100644
index 000000000000..745ba7a16d4c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_release.py
@@ -0,0 +1,51 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_api_release.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_release.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="a1",
+ release_id="testrev",
+ parameters={
+ "properties": {
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/a1",
+ "notes": "yahooagain",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceApiRelease.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_schema.py
new file mode 100644
index 000000000000..66adb51bad01
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_schema.py
@@ -0,0 +1,53 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_api_schema.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_schema.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="59d6bb8f1f7fab13dc67ec9b",
+ schema_id="ec12520d-9d48-4e7b-8f39-698ca2ac63f1",
+ parameters={
+ "properties": {
+ "contentType": "application/vnd.ms-azure-apim.xsd+xml",
+ "document": {
+ "value": '\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n'
+ },
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceApiSchema.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_version_set.py
new file mode 100644
index 000000000000..b0527fe0457f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_version_set.py
@@ -0,0 +1,51 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_api_version_set.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_version_set.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ version_set_id="api1",
+ parameters={
+ "properties": {
+ "description": "Version configuration",
+ "displayName": "api set 1",
+ "versioningScheme": "Segment",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceApiVersionSet.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_backend_proxy_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_backend_proxy_backend.py
new file mode 100644
index 000000000000..4d038375bbc9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_backend_proxy_backend.py
@@ -0,0 +1,58 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_backend_proxy_backend.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_backend.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ backend_id="proxybackend",
+ parameters={
+ "properties": {
+ "credentials": {
+ "authorization": {"parameter": "opensesma", "scheme": "Basic"},
+ "header": {"x-my-1": ["val1", "val2"]},
+ "query": {"sv": ["xx", "bb", "cc"]},
+ },
+ "description": "description5308",
+ "protocol": "http",
+ "proxy": {"password": "", "url": "http://192.168.1.1:8080", "username": "Contoso\\admin"},
+ "tls": {"validateCertificateChain": True, "validateCertificateName": True},
+ "url": "https://backendname2644/",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceBackendProxyBackend.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_backend_service_fabric.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_backend_service_fabric.py
new file mode 100644
index 000000000000..3c23e199f5aa
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_backend_service_fabric.py
@@ -0,0 +1,61 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_backend_service_fabric.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_backend.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ backend_id="sfbackend",
+ parameters={
+ "properties": {
+ "description": "Service Fabric Test App 1",
+ "properties": {
+ "serviceFabricCluster": {
+ "clientCertificateId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/certificates/cert1",
+ "managementEndpoints": ["https://somecluster.com"],
+ "maxPartitionResolutionRetries": 5,
+ "serverX509Names": [
+ {"issuerCertificateThumbprint": "IssuerCertificateThumbprint1", "name": "ServerCommonName1"}
+ ],
+ }
+ },
+ "protocol": "http",
+ "url": "fabric:/mytestapp/mytestservice",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceBackendServiceFabric.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_certificate.py
new file mode 100644
index 000000000000..4d6776d11089
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_certificate.py
@@ -0,0 +1,50 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_certificate.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_certificate.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ certificate_id="tempcert",
+ parameters={
+ "properties": {
+ "data": "****************Base 64 Encoded Certificate *******************************",
+ "password": "****Certificate Password******",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceCertificate.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_certificate_with_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_certificate_with_key_vault.py
new file mode 100644
index 000000000000..3e1076639452
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_certificate_with_key_vault.py
@@ -0,0 +1,52 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_certificate_with_key_vault.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_certificate.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ certificate_id="templateCertkv",
+ parameters={
+ "properties": {
+ "keyVault": {
+ "identityClientId": "ceaa6b06-c00f-43ef-99ac-f53d1fe876a0",
+ "secretIdentifier": "https://rpbvtkeyvaultintegration.vault-int.azure-int.net/secrets/msitestingCert",
+ }
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceCertificateWithKeyVault.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_diagnostic.py
new file mode 100644
index 000000000000..9be717169f24
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_diagnostic.py
@@ -0,0 +1,59 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_diagnostic.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_diagnostic.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ diagnostic_id="applicationinsights",
+ parameters={
+ "properties": {
+ "alwaysLog": "allErrors",
+ "backend": {
+ "request": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ "response": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ },
+ "frontend": {
+ "request": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ "response": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ },
+ "loggerId": "/workspaces/wks1/loggers/azuremonitor",
+ "sampling": {"percentage": 50, "samplingType": "fixed"},
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceDiagnostic.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_eh_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_eh_logger.py
new file mode 100644
index 000000000000..3eba43132d51
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_eh_logger.py
@@ -0,0 +1,54 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_eh_logger.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_logger.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ logger_id="eh1",
+ parameters={
+ "properties": {
+ "credentials": {
+ "connectionString": "Endpoint=sb://hydraeventhub-ns.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=********=",
+ "name": "hydraeventhub",
+ },
+ "description": "adding a new logger",
+ "loggerType": "azureEventHub",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceEHLogger.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_group.py
new file mode 100644
index 000000000000..264232b92c3b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_group.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_group.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="tempgroup",
+ parameters={"properties": {"displayName": "temp group"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceGroup.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_group_external.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_group_external.py
new file mode 100644
index 000000000000..218cb498efe4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_group_external.py
@@ -0,0 +1,52 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_group_external.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="aadGroup",
+ parameters={
+ "properties": {
+ "description": "new group to test",
+ "displayName": "NewGroup (samiraad.onmicrosoft.com)",
+ "externalId": "aad://samiraad.onmicrosoft.com/groups/83cf2753-5831-4675-bc0e-2f8dc067c58d",
+ "type": "external",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceGroupExternal.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_group_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_group_user.py
new file mode 100644
index 000000000000..ae1a598dce01
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_group_user.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_group_user.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group_user.create(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="tempgroup",
+ user_id="59307d350af58404d8a26300",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceGroupUser.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_named_value.py
new file mode 100644
index 000000000000..48e1144bace3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_named_value.py
@@ -0,0 +1,47 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_named_value.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testprop2",
+ parameters={
+ "properties": {"displayName": "prop3name", "secret": False, "tags": ["foo", "bar"], "value": "propValue"}
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceNamedValue.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_named_value_with_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_named_value_with_key_vault.py
new file mode 100644
index 000000000000..4c94763cdd47
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_named_value_with_key_vault.py
@@ -0,0 +1,55 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_named_value_with_key_vault.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testprop6",
+ parameters={
+ "properties": {
+ "displayName": "prop6namekv",
+ "keyVault": {
+ "identityClientId": "ceaa6b06-c00f-43ef-99ac-f53d1fe876a0",
+ "secretIdentifier": "https://contoso.vault.azure.net/secrets/aadSecret",
+ },
+ "secret": True,
+ "tags": ["foo", "bar"],
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceNamedValueWithKeyVault.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_notification.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_notification.py
new file mode 100644
index 000000000000..3c1b16522cf3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_notification.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_notification.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceNotification.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_notification_recipient_email.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_notification_recipient_email.py
new file mode 100644
index 000000000000..b8a7fa542619
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_notification_recipient_email.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_notification_recipient_email.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification_recipient_email.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ email="foobar@live.com",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceNotificationRecipientEmail.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_notification_recipient_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_notification_recipient_user.py
new file mode 100644
index 000000000000..93a845b1e6f1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_notification_recipient_user.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_notification_recipient_user.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification_recipient_user.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ user_id="576823d0a40f7e74ec07d642",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceNotificationRecipientUser.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_policy.py
new file mode 100644
index 000000000000..0c701016d039
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_policy.py
@@ -0,0 +1,50 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ policy_id="policy",
+ parameters={
+ "properties": {
+ "format": "xml",
+ "value": " ",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspacePolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_policy_fragment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_policy_fragment.py
new file mode 100644
index 000000000000..804b511c01b6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_policy_fragment.py
@@ -0,0 +1,51 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_policy_fragment.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy_fragment.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ id="policyFragment1",
+ parameters={
+ "properties": {
+ "description": "A policy fragment example",
+ "format": "xml",
+ "value": '',
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspacePolicyFragment.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_policy_non_xml_encoded.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_policy_non_xml_encoded.py
new file mode 100644
index 000000000000..0eaa76c9187d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_policy_non_xml_encoded.py
@@ -0,0 +1,50 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_policy_non_xml_encoded.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ policy_id="policy",
+ parameters={
+ "properties": {
+ "format": "rawxml",
+ "value": '\r\n \r\n \r\n \r\n "@(context.Request.Headers.FirstOrDefault(h => h.Ke=="Via"))" \r\n \r\n \r\n ',
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspacePolicyNonXmlEncoded.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_premium_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_premium_gateway.py
new file mode 100644
index 000000000000..c490bafacffb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_premium_gateway.py
@@ -0,0 +1,55 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_premium_gateway.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_gateway.begin_create_or_update(
+ resource_group_name="rg1",
+ gateway_name="apimGateway1",
+ parameters={
+ "location": "South Central US",
+ "properties": {
+ "backend": {
+ "subnet": {
+ "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vn1/subnets/sn1"
+ }
+ },
+ "virtualNetworkType": "External",
+ },
+ "sku": {"capacity": 1, "name": "WorkspaceGatewayPremium"},
+ "tags": {"Name": "Contoso", "Test": "User"},
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspacePremiumGateway.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_product.py
new file mode 100644
index 000000000000..6c1f7de3debe
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_product.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_product.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ parameters={"properties": {"displayName": "Test Template ProductName 4"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceProduct.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_product_api_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_product_api_link.py
new file mode 100644
index 000000000000..e754a4602a7c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_product_api_link.py
@@ -0,0 +1,50 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_product_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_api_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ api_link_id="link1",
+ parameters={
+ "properties": {
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/echo-api"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceProductApiLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_product_group_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_product_group_link.py
new file mode 100644
index 000000000000..f6071f6b29d3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_product_group_link.py
@@ -0,0 +1,50 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_product_group_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_group_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ group_link_id="link1",
+ parameters={
+ "properties": {
+ "groupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/groups/group1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceProductGroupLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_product_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_product_policy.py
new file mode 100644
index 000000000000..4a340ec6381c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_product_policy.py
@@ -0,0 +1,51 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_product_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_policy.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="5702e97e5157a50f48dce801",
+ policy_id="policy",
+ parameters={
+ "properties": {
+ "format": "xml",
+ "value": '\r\n \r\n \r\n \r\n @( string.Join(",", DateTime.UtcNow, context.Deployment.ServiceName, context.RequestId, context.Request.IpAddress, context.Operation.Name) ) \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceProductPolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_schema.py
new file mode 100644
index 000000000000..f9bea4becc9c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_schema.py
@@ -0,0 +1,51 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_schema.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_global_schema.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ schema_id="schema1",
+ parameters={
+ "properties": {
+ "description": "sample schema description",
+ "schemaType": "xml",
+ "value": '\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceSchema.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_subscription.py
new file mode 100644
index 000000000000..373177e67932
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_subscription.py
@@ -0,0 +1,51 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_subscription.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_subscription.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="testsub",
+ parameters={
+ "properties": {
+ "displayName": "testsub",
+ "ownerId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7",
+ "scope": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/products/5600b59475ff190048060002",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceSubscription.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_tag.py
new file mode 100644
index 000000000000..35b5145c8035
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_tag.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_tag.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tagId1",
+ parameters={"properties": {"displayName": "tag1"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceTag.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_tag_api_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_tag_api_link.py
new file mode 100644
index 000000000000..6d0ac573bd19
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_tag_api_link.py
@@ -0,0 +1,50 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_tag_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_api_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ api_link_id="link1",
+ parameters={
+ "properties": {
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/echo-api"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceTagApiLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_tag_operation_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_tag_operation_link.py
new file mode 100644
index 000000000000..2fa9df5e6b6a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_tag_operation_link.py
@@ -0,0 +1,50 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_tag_operation_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_operation_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ operation_link_id="link1",
+ parameters={
+ "properties": {
+ "operationId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/echo-api/operations/op1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceTagOperationLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_tag_product_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_tag_product_link.py
new file mode 100644
index 000000000000..e3a67b0815b5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_tag_product_link.py
@@ -0,0 +1,50 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_workspace_tag_product_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_product_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ product_link_id="link1",
+ parameters={
+ "properties": {
+ "productId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/products/product1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementCreateWorkspaceTagProductLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api.py
index 4bb68cfc66c1..73db72bce028 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api.py
@@ -27,17 +27,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- client.api.delete(
+ client.api.begin_delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="echo-api",
if_match="*",
- )
+ ).result()
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_diagnostic.py
index 55a9dc1a41f9..0fbaadbcdc00 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_diagnostic.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_diagnostic.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.api_diagnostic.delete(
@@ -39,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiDiagnostic.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApiDiagnostic.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue.py
index 827e38e93761..f180acd0690c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.api_issue.delete(
@@ -39,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiIssue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApiIssue.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_attachment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_attachment.py
index 1827d3f8232f..457b0874c89f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_attachment.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_attachment.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.api_issue_attachment.delete(
@@ -40,6 +40,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiIssueAttachment.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApiIssueAttachment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_comment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_comment.py
index 1827187fe125..51a78e788fed 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_comment.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_issue_comment.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.api_issue_comment.delete(
@@ -40,6 +40,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiIssueComment.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApiIssueComment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation.py
index 18ef26a3d397..f7d18d972524 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.api_operation.delete(
@@ -39,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiOperation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApiOperation.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_policy.py
index cb4e6cb981a9..b6a5c3d2098f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.api_operation_policy.delete(
@@ -45,6 +40,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiOperationPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApiOperationPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_tag.py
index 0a5d3fe9e06a..6f7edd2c34c2 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_operation_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.tag.detach_from_operation(
@@ -39,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiOperationTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApiOperationTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_policy.py
index 52a9df19721b..73ed1ec53f42 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.api_policy.delete(
@@ -44,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApiPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_release.py
index 202406766505..7c15eadc58b8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_release.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_release.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.api_release.delete(
@@ -39,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiRelease.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApiRelease.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_schema.py
index e3e6fe582d0e..65ec53030899 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_schema.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_schema.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.api_schema.delete(
@@ -39,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiSchema.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApiSchema.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag.py
index c948e711f62d..daf9fc05a031 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.tag.detach_from_api(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApiTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag_description.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag_description.py
index cddb3b56c747..a2683f94b143 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag_description.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_tag_description.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.api_tag_description.delete(
@@ -39,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiTagDescription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApiTagDescription.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_version_set.py
index 6b50c35a9e3f..e7064556e455 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_version_set.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_version_set.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.api_version_set.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiVersionSet.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApiVersionSet.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_wiki.py
index e52729d05db5..bc3784235996 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_wiki.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_api_wiki.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.api_wiki.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApiWiki.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteApiWiki.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization.py
index f5732609c933..559b2fef64ca 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.authorization.delete(
@@ -39,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteAuthorization.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteAuthorization.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_access_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_access_policy.py
index 95e849238c7a..ee56beeb031b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_access_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_access_policy.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.authorization_access_policy.delete(
@@ -40,6 +40,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteAuthorizationAccessPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteAuthorizationAccessPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_provider.py
index cc7a5fb19f6e..f62fe1f10872 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_provider.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_provider.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.authorization_provider.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteAuthorizationProvider.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteAuthorizationProvider.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_server.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_server.py
index d25e8269a16e..3c9db988d145 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_server.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_authorization_server.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.authorization_server.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteAuthorizationServer.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteAuthorizationServer.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_backend.py
index 56494fb40d52..0761f9517872 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_backend.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_backend.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.backend.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteBackend.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteBackend.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_cache.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_cache.py
index f41a809feaef..5f47b6e55e16 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_cache.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_cache.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.cache.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteCache.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteCache.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_certificate.py
index b5a2f695a547..78f73e3f9440 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_certificate.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_certificate.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.certificate.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteCertificate.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteCertificate.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type.py
index 6aa6ad3d4f19..96283690cfc5 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.content_type.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteContentType.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteContentType.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type_content_item.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type_content_item.py
index 0fcec8d006aa..f4ee689b1a7c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type_content_item.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_content_type_content_item.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.content_item.delete(
@@ -39,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteContentTypeContentItem.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteContentTypeContentItem.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_diagnostic.py
index 9c31ab72a752..f20325a5b0bf 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_diagnostic.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_diagnostic.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.diagnostic.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteDiagnostic.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteDiagnostic.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway.py
index 77f01bb30929..608613651de4 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.gateway.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGateway.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteGateway.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_api.py
index 00f48c23f97c..d9d924c12874 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_api.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_api.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.gateway_api.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGatewayApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteGatewayApi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_certificate_authority.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_certificate_authority.py
index 866810f0f7ea..52b76bbc6184 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_certificate_authority.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_certificate_authority.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.gateway_certificate_authority.delete(
@@ -39,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGatewayCertificateAuthority.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteGatewayCertificateAuthority.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_config_connection.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_config_connection.py
new file mode 100644
index 000000000000..fdc4e9481fc7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_config_connection.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_gateway_config_connection.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.api_gateway_config_connection.begin_delete(
+ resource_group_name="rg1",
+ gateway_name="standard-gw-01",
+ config_connection_name="gcc-01",
+ if_match="*",
+ ).result()
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteGatewayConfigConnection.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_hostname_configuration.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_hostname_configuration.py
index 972a4837e74c..76959504612d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_hostname_configuration.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_gateway_hostname_configuration.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.gateway_hostname_configuration.delete(
@@ -39,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGatewayHostnameConfiguration.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteGatewayHostnameConfiguration.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_global_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_global_schema.py
index cab1d5a319a5..70f200acfd91 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_global_schema.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_global_schema.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.global_schema.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGlobalSchema.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteGlobalSchema.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver.py
index 50c4c63ce963..7254085514a3 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.graph_ql_api_resolver.delete(
@@ -39,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGraphQLApiResolver.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteGraphQLApiResolver.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver_policy.py
index b3b873fff3d1..4811e1f7d077 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_graph_ql_api_resolver_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.graph_ql_api_resolver_policy.delete(
@@ -45,6 +40,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGraphQLApiResolverPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteGraphQLApiResolverPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group.py
index 31ff1b1fe3dc..248faee87bd0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.group.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGroup.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group_user.py
index bb43bfbb2f9d..c9ba3e77e100 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group_user.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_group_user.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.group_user.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteGroupUser.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteGroupUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_identity_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_identity_provider.py
index c694ca5a7ba6..d533b97ecc1a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_identity_provider.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_identity_provider.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.identity_provider.delete(
@@ -43,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteIdentityProvider.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteIdentityProvider.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_logger.py
index 28317a5bfc68..44cc0555e63a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_logger.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_logger.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.logger.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteLogger.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteLogger.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_named_value.py
index f5c796873d3c..c99a5c12124d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_named_value.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_named_value.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.named_value.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteNamedValue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteNamedValue.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_email.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_email.py
index 330851fa2b30..5f5faec4f451 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_email.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_email.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.notification_recipient_email.delete(
@@ -43,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteNotificationRecipientEmail.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteNotificationRecipientEmail.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_user.py
index 9a6b8e99742d..60b386dc336f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_user.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_notification_recipient_user.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.notification_recipient_user.delete(
@@ -43,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteNotificationRecipientUser.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteNotificationRecipientUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_open_id_connect_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_open_id_connect_provider.py
index 297712b1f5ea..7342bc52cbd0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_open_id_connect_provider.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_open_id_connect_provider.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.open_id_connect_provider.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteOpenIdConnectProvider.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteOpenIdConnectProvider.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy.py
index 246c406b1791..5126ef177e88 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.policy.delete(
@@ -43,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeletePolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeletePolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_fragment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_fragment.py
index 74851e77959b..cf4c0bfc4bbc 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_fragment.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_fragment.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.policy_fragment.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeletePolicyFragment.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeletePolicyFragment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_restriction.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_restriction.py
new file mode 100644
index 000000000000..448f11f0d7e0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_restriction.py
@@ -0,0 +1,42 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_policy_restriction.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.policy_restriction.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ policy_restriction_id="policyRestriction1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeletePolicyRestriction.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_private_endpoint_connection.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_private_endpoint_connection.py
index fc164db00fd8..88ab90e06654 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_private_endpoint_connection.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_private_endpoint_connection.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.private_endpoint_connection.begin_delete(
@@ -37,6 +37,6 @@ def main():
).result()
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeletePrivateEndpointConnection.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeletePrivateEndpointConnection.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product.py
index 7e1ddaec2635..211650b3eeaa 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.product.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteProduct.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteProduct.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_api.py
index d97b1bba40d0..bb8d2bbc628d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_api.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_api.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.product_api.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteProductApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteProductApi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_api_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_api_link.py
new file mode 100644
index 000000000000..7a7927226e27
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_api_link.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_product_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.product_api_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ product_id="testproduct",
+ api_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteProductApiLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_group.py
index 2e9f5b417a6e..98eaad7e7e28 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_group.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_group.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.product_group.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteProductGroup.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteProductGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_group_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_group_link.py
new file mode 100644
index 000000000000..b76606c50594
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_group_link.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_product_group_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.product_group_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ product_id="testproduct",
+ group_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteProductGroupLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_policy.py
index 874c469d4c5f..f31e8d024b53 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.product_policy.delete(
@@ -44,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteProductPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteProductPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_tag.py
index 0b12e0908788..d9777502b6cb 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.tag.detach_from_product(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteProductTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteProductTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_wiki.py
index 8d69fbdad9b7..3c062b84e5a4 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_wiki.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_wiki.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.product_wiki.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteProductWiki.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteProductWiki.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_subscription.py
index cabb2c534cc3..e272baa518f0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_subscription.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_subscription.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.subscription.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteSubscription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteSubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag.py
index 7345d7055f2e..ca4f1c3375f1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.tag.delete(
@@ -38,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag_api_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag_api_link.py
new file mode 100644
index 000000000000..efb51049252a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag_api_link.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_tag_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.tag_api_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ api_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteTagApiLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag_operation_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag_operation_link.py
new file mode 100644
index 000000000000..c9e9f2d8ecf4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag_operation_link.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_tag_operation_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.tag_operation_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ operation_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteTagOperationLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag_product_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag_product_link.py
new file mode 100644
index 000000000000..ac3ecfa1128f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag_product_link.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_tag_product_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.tag_product_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ product_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteTagProductLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_template.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_template.py
index de0ce6f4a590..7efd9efdd68c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_template.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_template.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.email_template.delete(
@@ -43,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteTemplate.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteTemplate.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_user.py
index 91104a6c4bc1..6ec5ba5e228a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_user.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_user.py
@@ -27,17 +27,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- client.user.delete(
+ client.user.begin_delete(
resource_group_name="rg1",
service_name="apimService1",
user_id="5931a75ae4bbd512288c680b",
if_match="*",
- )
+ ).result()
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteUser.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_documentation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace.py
similarity index 83%
rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_documentation.py
rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace.py
index e205a5b0b984..9076fd2c30d2 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_documentation.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace.py
@@ -15,7 +15,7 @@
pip install azure-identity
pip install azure-mgmt-apimanagement
# USAGE
- python api_management_delete_documentation.py
+ python api_management_delete_workspace.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
@@ -27,17 +27,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- client.documentation.delete(
+ client.workspace.delete(
resource_group_name="rg1",
service_name="apimService1",
- documentation_id="57d1f7558aa04f15146d9d8a",
+ workspace_id="wks1",
if_match="*",
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteDocumentation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspace.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api.py
new file mode 100644
index 000000000000..61e223af97f9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_api.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="echo-api",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceApi.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_diagnostic.py
new file mode 100644
index 000000000000..ef66f2b3d64d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_diagnostic.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_api_diagnostic.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api_diagnostic.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d1f7558aa04f15146d9d8a",
+ diagnostic_id="applicationinsights",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceApiDiagnostic.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_operation.py
new file mode 100644
index 000000000000..e4cdb70001a5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_operation.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_api_operation.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api_operation.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d2ef278aa04f0888cba3f3",
+ operation_id="57d2ef278aa04f0ad01d6cdc",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceApiOperation.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_operation_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_operation_policy.py
new file mode 100644
index 000000000000..273f6a7f5729
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_operation_policy.py
@@ -0,0 +1,46 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_api_operation_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api_operation_policy.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="testapi",
+ operation_id="testoperation",
+ policy_id="policy",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceApiOperationPolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_policy.py
new file mode 100644
index 000000000000..adf7f29d64f9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_policy.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_api_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api_policy.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="loggerId",
+ policy_id="policy",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceApiPolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_release.py
new file mode 100644
index 000000000000..d3b4fe7235df
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_release.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_api_release.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api_release.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5a5fcc09124a7fa9b89f2f1d",
+ release_id="testrev",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceApiRelease.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_schema.py
new file mode 100644
index 000000000000..1bf5a8e0d456
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_schema.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_api_schema.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api_schema.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="59d5b28d1f7fab116c282650",
+ schema_id="59d5b28e1f7fab116402044e",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceApiSchema.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_version_set.py
new file mode 100644
index 000000000000..a7f2ba689a71
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_api_version_set.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_api_version_set.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api_version_set.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ version_set_id="a1",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceApiVersionSet.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_backend.py
new file mode 100644
index 000000000000..774a4ad10887
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_backend.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_backend.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_backend.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ backend_id="sfbackend",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceBackend.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_certificate.py
new file mode 100644
index 000000000000..9006459ef6a0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_certificate.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_certificate.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_certificate.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ certificate_id="tempcert",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceCertificate.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_diagnostic.py
new file mode 100644
index 000000000000..631305eaa00e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_diagnostic.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_diagnostic.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_diagnostic.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ diagnostic_id="applicationinsights",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceDiagnostic.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_group.py
new file mode 100644
index 000000000000..72c567323bea
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_group.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_group.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_group.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="aadGroup",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceGroup.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_group_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_group_user.py
new file mode 100644
index 000000000000..c7e0c2e95fab
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_group_user.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_group_user.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_group_user.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="templategroup",
+ user_id="59307d350af58404d8a26300",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceGroupUser.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_logger.py
new file mode 100644
index 000000000000..2adc80057f57
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_logger.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_logger.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_logger.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ logger_id="loggerId",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceLogger.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_named_value.py
new file mode 100644
index 000000000000..284457db804b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_named_value.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_named_value.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_named_value.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testprop2",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceNamedValue.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_notification_recipient_email.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_notification_recipient_email.py
new file mode 100644
index 000000000000..b345e331ca8f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_notification_recipient_email.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_notification_recipient_email.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_notification_recipient_email.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ email="contoso@live.com",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceNotificationRecipientEmail.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_notification_recipient_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_notification_recipient_user.py
new file mode 100644
index 000000000000..c2167a59d2cb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_notification_recipient_user.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_notification_recipient_user.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_notification_recipient_user.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ user_id="576823d0a40f7e74ec07d642",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceNotificationRecipientUser.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_policy.py
new file mode 100644
index 000000000000..e76dc517788c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_policy.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_policy.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ policy_id="policy",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspacePolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_policy_fragment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_policy_fragment.py
new file mode 100644
index 000000000000..e2c20663e0d9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_policy_fragment.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_policy_fragment.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_policy_fragment.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ id="policyFragment1",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspacePolicyFragment.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_product.py
new file mode 100644
index 000000000000..72f72e4aac1e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_product.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_product.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_product.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceProduct.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_product_api_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_product_api_link.py
new file mode 100644
index 000000000000..844eea2f958a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_product_api_link.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_product_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_product_api_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ api_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceProductApiLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_product_group_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_product_group_link.py
new file mode 100644
index 000000000000..743cacefb00e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_product_group_link.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_product_group_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_product_group_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ group_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceProductGroupLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_product_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_product_policy.py
new file mode 100644
index 000000000000..36f5bf75ff1c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_product_policy.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_product_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_product_policy.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ policy_id="policy",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceProductPolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_schema.py
new file mode 100644
index 000000000000..ef1d7802a601
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_schema.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_schema.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_global_schema.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ schema_id="schema1",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceSchema.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_subscription.py
new file mode 100644
index 000000000000..bb6c8274e53c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_subscription.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_subscription.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_subscription.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="testsub",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceSubscription.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_tag.py
new file mode 100644
index 000000000000..4ef347966dc7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_tag.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_tag.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_tag.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tagId1",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceTag.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_tag_api_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_tag_api_link.py
new file mode 100644
index 000000000000..3bff35fd436a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_tag_api_link.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_tag_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_tag_api_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ api_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceTagApiLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_tag_operation_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_tag_operation_link.py
new file mode 100644
index 000000000000..fcccdc0945e9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_tag_operation_link.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_tag_operation_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_tag_operation_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ operation_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceTagOperationLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_tag_product_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_tag_product_link.py
new file mode 100644
index 000000000000..902b070a68c3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_tag_product_link.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_workspace_tag_product_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_tag_product_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ product_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeleteWorkspaceTagProductLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_list_by_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_list_by_subscription.py
index ed919f3341fd..8826496e0a9a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_list_by_subscription.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_list_by_subscription.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.deleted_services.list_by_subscription()
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeletedServicesListBySubscription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeletedServicesListBySubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_purge.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_purge.py
index 06cd5675a080..d7796df6777c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_purge.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_deleted_services_purge.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.deleted_services.begin_purge(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeletedServicesPurge.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementDeletedServicesPurge.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_delete_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_delete_gateway.py
new file mode 100644
index 000000000000..9518ebc50e99
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_delete_gateway.py
@@ -0,0 +1,42 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_gateway_delete_gateway.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_gateway.begin_delete(
+ resource_group_name="rg1",
+ gateway_name="example-gateway",
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGatewayDeleteGateway.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_generate_token.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_generate_token.py
index 0de4c30147b6..0d0498719847 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_generate_token.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_generate_token.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway.generate_token(
@@ -41,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGatewayGenerateToken.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGatewayGenerateToken.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_get_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_get_gateway.py
new file mode 100644
index 000000000000..dcaa2c64eaf8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_get_gateway.py
@@ -0,0 +1,42 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_gateway_get_gateway.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_gateway.get(
+ resource_group_name="rg1",
+ gateway_name="apimService1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGatewayGetGateway.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_invalidate_debug_credentials.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_invalidate_debug_credentials.py
new file mode 100644
index 000000000000..7de39bcaeff3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_invalidate_debug_credentials.py
@@ -0,0 +1,42 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_gateway_invalidate_debug_credentials.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.gateway.invalidate_debug_credentials(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ gateway_id="gw1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGatewayInvalidateDebugCredentials.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_debug_credentials.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_debug_credentials.py
new file mode 100644
index 000000000000..692fcb853c71
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_debug_credentials.py
@@ -0,0 +1,48 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_gateway_list_debug_credentials.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.gateway.list_debug_credentials(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ gateway_id="gw1",
+ parameters={
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1",
+ "credentialsExpireAfter": "PT1H",
+ "purposes": ["tracing"],
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGatewayListDebugCredentials.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_keys.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_keys.py
index 6f684b85ba1a..92adb92e8535 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_keys.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_keys.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway.list_keys(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGatewayListKeys.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGatewayListKeys.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_trace.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_trace.py
new file mode 100644
index 000000000000..542d887454e0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_trace.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_gateway_list_trace.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.gateway.list_trace(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ gateway_id="gw1",
+ parameters={"traceId": "CrDvXXXXXXXXXXXXXVU3ZA2-1"},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGatewayListTrace.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_regenerate_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_regenerate_key.py
index d8ca06e71e5a..39021d344521 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_regenerate_key.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_regenerate_key.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.gateway.regenerate_key(
@@ -40,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGatewayRegenerateKey.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGatewayRegenerateKey.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_contract.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_contract.py
index 8ee81c7656b4..809c61e27085 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_contract.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_contract.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiContract.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiContract.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_diagnostic.py
index 2964b8c270c8..4bae0e0f5727 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_diagnostic.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_diagnostic.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_diagnostic.get(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiDiagnostic.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiDiagnostic.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api2dot0.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api2dot0.py
index 5e40f4521d23..70b1517e8693 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api2dot0.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api2dot0.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_export.get(
@@ -45,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiExportInOpenApi2dot0.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiExportInOpenApi2dot0.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api3dot0.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api3dot0.py
index f3b9bccce595..2fa23c9c61aa 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api3dot0.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_export_in_open_api3dot0.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_export.get(
@@ -45,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiExportInOpenApi3dot0.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiExportInOpenApi3dot0.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue.py
index 96e02aee1f79..0df0ebc0eed2 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue.get(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiIssue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiIssue.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_attachment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_attachment.py
index 2ddf67d2b24c..ab0bfaae1f52 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_attachment.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_attachment.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_attachment.get(
@@ -40,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiIssueAttachment.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiIssueAttachment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_comment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_comment.py
index a37524cc58d7..d3a4a40f835e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_comment.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_issue_comment.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_comment.get(
@@ -40,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiIssueComment.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiIssueComment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation.py
index dc700cfa8f56..b1e1f575ddcb 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation.get(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiOperation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiOperation.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_pet_store.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_pet_store.py
index 908036d62923..582102ad5da7 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_pet_store.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_pet_store.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation.get(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiOperationPetStore.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiOperationPetStore.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_policy.py
index 25de9d95fe29..9740d34aa8f3 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation_policy.get(
@@ -45,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiOperationPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiOperationPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_tag.py
index ddb5a13fd4a3..575a62610907 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_operation_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get_by_operation(
@@ -40,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiOperationTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiOperationTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_policy.py
index e0a7e30f5427..8492145143a1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_policy.get(
@@ -44,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_release.py
index 02614487f48d..814efd1756f1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_release.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_release.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_release.get(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiRelease.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiRelease.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_revision.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_revision.py
index 41db9662047e..f18c0b12aa7f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_revision.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_revision.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiRevision.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiRevision.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_schema.py
index 37912612399e..e2e4fe62133b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_schema.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_schema.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_schema.get(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiSchema.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiSchema.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag.py
index 2f4385e8cd49..dca7e7f1bff6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get_by_api(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag_description.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag_description.py
index 32e617f9d396..69821ba3db5c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag_description.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_tag_description.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_tag_description.get(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiTagDescription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiTagDescription.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_version_set.py
index 4bb0d23484a9..011d6f1cde84 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_version_set.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_version_set.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_version_set.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiVersionSet.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiVersionSet.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_wiki.py
index 29e84e21edc9..4db678998b49 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_wiki.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_api_wiki.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_wiki.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiWiki.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetApiWiki.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization.py
index 08d36cea5fed..8126556a1be1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization.get(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetAuthorization.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetAuthorization.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_access_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_access_policy.py
index 495a8a8ae81e..28c2c2616b22 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_access_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_access_policy.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_access_policy.get(
@@ -40,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetAuthorizationAccessPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetAuthorizationAccessPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_login_request.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_login_request.py
index 4dc17670ea5d..97e67735f28f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_login_request.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_login_request.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_login_links.post(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetAuthorizationLoginRequest.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetAuthorizationLoginRequest.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_provider.py
index 9ea39097ab71..d4ff871b7f87 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_provider.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_provider.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_provider.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetAuthorizationProvider.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetAuthorizationProvider.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_server.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_server.py
index 6affc8c4ebec..36bab6f86656 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_server.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_authorization_server.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_server.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetAuthorizationServer.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetAuthorizationServer.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_backend.py
index 444ff20108c4..fac5b11c4f08 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_backend.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_backend.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.backend.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetBackend.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetBackend.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_cache.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_cache.py
index 2059cee7c260..61fc37230724 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_cache.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_cache.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.cache.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetCache.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetCache.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate.py
index 91e7c6b67ba3..c99bb9555d93 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.certificate.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetCertificate.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetCertificate.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate_with_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate_with_key_vault.py
index 5e2dde379d7e..e3a409b6b577 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate_with_key_vault.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_certificate_with_key_vault.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.certificate.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetCertificateWithKeyVault.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetCertificateWithKeyVault.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type.py
index c4a2e511c263..2334b2e4420b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_type.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetContentType.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetContentType.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type_content_item.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type_content_item.py
index 803cde0ee5e3..af1135d239f8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type_content_item.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_content_type_content_item.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_item.get(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetContentTypeContentItem.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetContentTypeContentItem.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_deleted_service_by_name.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_deleted_service_by_name.py
index ae186cb7e7ba..9a05a82b9134 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_deleted_service_by_name.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_deleted_service_by_name.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.deleted_services.get_by_name(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetDeletedServiceByName.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetDeletedServiceByName.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_diagnostic.py
index b630143394d4..d7716f4fddc8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_diagnostic.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_diagnostic.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.diagnostic.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetDiagnostic.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetDiagnostic.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_documentation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_documentation.py
index c49cdbe4b441..c8e33a2769c6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_documentation.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_documentation.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.documentation.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetDocumentation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetDocumentation.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway.py
index 9a3bd49a369d..4f0fff95d6e3 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetGateway.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetGateway.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_certificate_authority.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_certificate_authority.py
index b00c32221a67..574d335abb1a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_certificate_authority.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_certificate_authority.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_certificate_authority.get(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetGatewayCertificateAuthority.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetGatewayCertificateAuthority.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_config_connection.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_config_connection.py
new file mode 100644
index 000000000000..c78a8ee40703
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_config_connection.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_gateway_config_connection.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_gateway_config_connection.get(
+ resource_group_name="rg1",
+ gateway_name="standard-gw-01",
+ config_connection_name="gcc-01",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetGatewayConfigConnection.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_hostname_configuration.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_hostname_configuration.py
index d24d55c66755..c8bb757c3737 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_hostname_configuration.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_gateway_hostname_configuration.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_hostname_configuration.get(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetGatewayHostnameConfiguration.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetGatewayHostnameConfiguration.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema1.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema1.py
index c889aa01b480..5ca04e50533e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema1.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema1.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.global_schema.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetGlobalSchema1.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetGlobalSchema1.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema2.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema2.py
index 3f052c323de3..54cd23588ca4 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema2.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_global_schema2.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.global_schema.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetGlobalSchema2.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetGlobalSchema2.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver.py
index 5116772f83da..0ccf3b96a8d8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver.get(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetGraphQLApiResolver.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetGraphQLApiResolver.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver_policy.py
index cd11ba532dd6..98ea1215a9cd 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_graph_ql_api_resolver_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver_policy.get(
@@ -45,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetGraphQLApiResolverPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetGraphQLApiResolverPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_group.py
index 0d89263d91f1..84c459acfb85 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_group.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_group.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetGroup.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_identity_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_identity_provider.py
index 09e7f6d9c4b3..9cbdc8a5f825 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_identity_provider.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_identity_provider.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.identity_provider.get(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetIdentityProvider.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetIdentityProvider.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_issue.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_issue.py
index 8c040c16e68f..b7c3e42210e0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_issue.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_issue.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.issue.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetIssue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetIssue.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_logger.py
index f6f4e24c9d4a..3dfa9bac942b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_logger.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_logger.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.logger.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetLogger.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetLogger.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value.py
index 176e4d9fe2c7..159e7f0a34e6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetNamedValue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetNamedValue.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value_with_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value_with_key_vault.py
index 5712f4498e3a..f75e91fd6626 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value_with_key_vault.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_named_value_with_key_vault.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetNamedValueWithKeyVault.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetNamedValueWithKeyVault.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_notification.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_notification.py
index e6fead4414bb..5281baa7ce17 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_notification.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_notification.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification.get(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetNotification.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetNotification.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_open_id_connect_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_open_id_connect_provider.py
index 423019a12081..3e73cc6f7129 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_open_id_connect_provider.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_open_id_connect_provider.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.open_id_connect_provider.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetOpenIdConnectProvider.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetOpenIdConnectProvider.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_operation_result.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_operation_result.py
new file mode 100644
index 000000000000..bd19491cf6fb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_operation_result.py
@@ -0,0 +1,41 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_operation_result.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.operations_results.get(
+ location="westus2",
+ operation_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetOperationResult.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_operation_status.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_operation_status.py
new file mode 100644
index 000000000000..726cc831a09b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_operation_status.py
@@ -0,0 +1,42 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_operation_status.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.operation_status.get(
+ location="testLocation",
+ operation_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetOperationStatus.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy.py
index e612230cf757..ea3ad052c52b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy.get(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_format.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_format.py
index 12a600ddbdc8..55728a1d0415 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_format.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_format.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy.get(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetPolicyFormat.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetPolicyFormat.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment.py
index 533027279d66..d7f85b4cb110 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy_fragment.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetPolicyFragment.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetPolicyFragment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment_format.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment_format.py
index b9546109675a..7ccf4c194a73 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment_format.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_fragment_format.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy_fragment.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetPolicyFragmentFormat.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetPolicyFragmentFormat.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_restriction.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_restriction.py
new file mode 100644
index 000000000000..b5c24e643ccc
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_restriction.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_policy_restriction.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.policy_restriction.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ policy_restriction_id="policyRestriction1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetPolicyRestriction.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_portal_revision.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_portal_revision.py
index 45dfbfdffd76..2ee6d0bfb89e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_portal_revision.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_portal_revision.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_revision.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetPortalRevision.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetPortalRevision.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_endpoint_connection.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_endpoint_connection.py
index 8e29d2e0b881..47e8db6ee0ec 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_endpoint_connection.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_endpoint_connection.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.private_endpoint_connection.get_by_name(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetPrivateEndpointConnection.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetPrivateEndpointConnection.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_link_group_resource.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_link_group_resource.py
index eb867e0cd4ea..32f3294aa51f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_link_group_resource.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_private_link_group_resource.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.private_endpoint_connection.get_private_link_resource(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetPrivateLinkGroupResource.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetPrivateLinkGroupResource.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product.py
index 4344d348dc72..a631770e2ad6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetProduct.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetProduct.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_api_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_api_link.py
new file mode 100644
index 000000000000..3209a5ea81fb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_api_link.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_product_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.product_api_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ product_id="testproduct",
+ api_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetProductApiLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_group_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_group_link.py
new file mode 100644
index 000000000000..08beda018ea1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_group_link.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_product_group_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.product_group_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ product_id="testproduct",
+ group_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetProductGroupLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_policy.py
index a3e668e5dc6c..3577bb008695 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_policy.get(
@@ -44,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetProductPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetProductPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_tag.py
index 714e96baa7dc..6e784df2c057 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get_by_product(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetProductTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetProductTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_wiki.py
index 75f97bdb7608..d19d65bf8e89 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_wiki.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_product_wiki.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_wiki.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetProductWiki.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetProductWiki.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys.py
index 61f0b35132ae..f410cd5929c8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.quota_by_counter_keys.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetQuotaCounterKeys.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetQuotaCounterKeys.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys_by_quota_period.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys_by_quota_period.py
index a14df6e14f5a..399a291b4658 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys_by_quota_period.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_quota_counter_keys_by_quota_period.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.quota_by_period_keys.get(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetQuotaCounterKeysByQuotaPeriod.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetQuotaCounterKeysByQuotaPeriod.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_api.py
new file mode 100644
index 000000000000..f8d6a908d261
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_api.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_reports_by_api.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.reports.list_by_api(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetReportsByApi.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_geo.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_geo.py
new file mode 100644
index 000000000000..5b4e6a47ca44
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_geo.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_reports_by_geo.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.reports.list_by_geo(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetReportsByGeo.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_operation.py
new file mode 100644
index 000000000000..dfaac597e8b9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_operation.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_reports_by_operation.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.reports.list_by_operation(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetReportsByOperation.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_product.py
new file mode 100644
index 000000000000..7285fa52fd0e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_product.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_reports_by_product.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.reports.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetReportsByProduct.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_request.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_request.py
new file mode 100644
index 000000000000..da8ab9ac49ef
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_request.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_reports_by_request.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.reports.list_by_request(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetReportsByRequest.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_subscription.py
new file mode 100644
index 000000000000..3a62a22943c0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_subscription.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_reports_by_subscription.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.reports.list_by_subscription(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetReportsBySubscription.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_time.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_time.py
new file mode 100644
index 000000000000..75ab6919a95b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_time.py
@@ -0,0 +1,47 @@
+# 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 isodate
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_reports_by_time.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.reports.list_by_time(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
+ interval=isodate.parse_duration("PT15M"),
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetReportsByTime.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_user.py
new file mode 100644
index 000000000000..792d85abcd33
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_user.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_reports_by_user.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.reports.list_by_user(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetReportsByUser.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_subscription.py
index 4ec7c62ac178..031622de75cc 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_subscription.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_subscription.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.subscription.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetSubscription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetSubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag.py
index 304f4ec47d3f..e1889fad224f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag_api_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag_api_link.py
new file mode 100644
index 000000000000..42254df79485
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag_api_link.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_tag_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_api_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ api_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetTagApiLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag_operation_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag_operation_link.py
new file mode 100644
index 000000000000..ae5eb9c10978
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag_operation_link.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_tag_operation_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_operation_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ operation_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetTagOperationLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag_product_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag_product_link.py
new file mode 100644
index 000000000000..e868462431ab
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tag_product_link.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_tag_product_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_product_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ product_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetTagProductLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_template.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_template.py
index 9c3a204d67f4..4e59327fe6d4 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_template.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_template.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.email_template.get(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetTemplate.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetTemplate.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_access.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_access.py
index 842d3d94bb27..3cc7099e6603 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_access.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_access.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_access.get(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetTenantAccess.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetTenantAccess.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_git_access.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_git_access.py
index 0d9f70892ff5..2282775c1229 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_git_access.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_git_access.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_access.get(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetTenantGitAccess.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetTenantGitAccess.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_settings.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_settings.py
index ccd5bcdef0a8..79d158c1676f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_settings.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_tenant_settings.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_settings.get(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetTenantSettings.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetTenantSettings.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user.py
index 5b147fe993e8..cd825e6faed8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetUser.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user_subscription.py
index c9c15c2c77cd..b3849709fce1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user_subscription.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_user_subscription.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user_subscription.get(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetUserSubscription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetUserSubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace.py
new file mode 100644
index 000000000000..2ab889ca7813
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspace.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_contract.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_contract.py
new file mode 100644
index 000000000000..f3714f0b857b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_contract.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_api_contract.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d1f7558aa04f15146d9d8a",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceApiContract.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_diagnostic.py
new file mode 100644
index 000000000000..dfaa754423e6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_diagnostic.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_api_diagnostic.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_diagnostic.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d1f7558aa04f15146d9d8a",
+ diagnostic_id="applicationinsights",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceApiDiagnostic.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_export_in_open_api2dot0.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_export_in_open_api2dot0.py
new file mode 100644
index 000000000000..b2ea10c6f3a5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_export_in_open_api2dot0.py
@@ -0,0 +1,46 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_api_export_in_open_api2dot0.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_export.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="echo-api",
+ format="swagger-link",
+ export="true",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceApiExportInOpenApi2dot0.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_export_in_open_api3dot0.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_export_in_open_api3dot0.py
new file mode 100644
index 000000000000..cb0f1fba0930
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_export_in_open_api3dot0.py
@@ -0,0 +1,46 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_api_export_in_open_api3dot0.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_export.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="aid9676",
+ format="openapi-link",
+ export="true",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceApiExportInOpenApi3dot0.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_operation.py
new file mode 100644
index 000000000000..92643b47af6b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_operation.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_api_operation.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d2ef278aa04f0888cba3f3",
+ operation_id="57d2ef278aa04f0ad01d6cdc",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceApiOperation.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_operation_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_operation_policy.py
new file mode 100644
index 000000000000..08e1dda6d3bf
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_operation_policy.py
@@ -0,0 +1,46 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_api_operation_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation_policy.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5600b539c53f5b0062040001",
+ operation_id="5600b53ac53f5b0062080006",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceApiOperationPolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_policy.py
new file mode 100644
index 000000000000..503d377dcc0c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_policy.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_api_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_policy.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5600b59475ff190048040001",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceApiPolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_release.py
new file mode 100644
index 000000000000..24ba1579d95b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_release.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_api_release.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_release.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="a1",
+ release_id="5a7cb545298324c53224a799",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceApiRelease.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_revision.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_revision.py
new file mode 100644
index 000000000000..c074d9ded138
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_revision.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_api_revision.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="echo-api;rev=3",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceApiRevision.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_schema.py
new file mode 100644
index 000000000000..ed9794e690cf
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_schema.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_api_schema.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_schema.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="59d6bb8f1f7fab13dc67ec9b",
+ schema_id="ec12520d-9d48-4e7b-8f39-698ca2ac63f1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceApiSchema.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_version_set.py
new file mode 100644
index 000000000000..5999659c9fa3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_version_set.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_api_version_set.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_version_set.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ version_set_id="vs1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceApiVersionSet.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_backend.py
new file mode 100644
index 000000000000..f8cdf774e2da
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_backend.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_backend.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_backend.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ backend_id="sfbackend",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceBackend.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_certificate.py
new file mode 100644
index 000000000000..178efafcec13
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_certificate.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_certificate.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_certificate.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ certificate_id="templateCert1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceCertificate.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_certificate_with_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_certificate_with_key_vault.py
new file mode 100644
index 000000000000..b69dfaa9b635
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_certificate_with_key_vault.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_certificate_with_key_vault.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_certificate.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ certificate_id="templateCertkv",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceCertificateWithKeyVault.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_diagnostic.py
new file mode 100644
index 000000000000..e53eb1b77b30
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_diagnostic.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_diagnostic.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_diagnostic.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ diagnostic_id="applicationinsights",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceDiagnostic.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_group.py
new file mode 100644
index 000000000000..6579a5e55589
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_group.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_group.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="59306a29e4bbd510dc24e5f9",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceGroup.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_link.py
new file mode 100644
index 000000000000..d4098a9a6faa
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_link.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_management_workspace_link.get(
+ resource_group_name="rg1",
+ service_name="service1",
+ workspace_id="wk-1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_logger.py
new file mode 100644
index 000000000000..5ff7529b735a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_logger.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_logger.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_logger.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ logger_id="templateLogger",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceLogger.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_named_value.py
new file mode 100644
index 000000000000..2270ae668244
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_named_value.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_named_value.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testarmTemplateproperties2",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceNamedValue.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_named_value_with_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_named_value_with_key_vault.py
new file mode 100644
index 000000000000..212a65494379
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_named_value_with_key_vault.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_named_value_with_key_vault.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testprop6",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceNamedValueWithKeyVault.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_notification.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_notification.py
new file mode 100644
index 000000000000..1a2d38f35716
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_notification.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_notification.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceNotification.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_policy.py
new file mode 100644
index 000000000000..55e2a60168a2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_policy.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspacePolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_policy_fragment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_policy_fragment.py
new file mode 100644
index 000000000000..8fd0eef62c9a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_policy_fragment.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_policy_fragment.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy_fragment.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ id="policyFragment1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspacePolicyFragment.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_policy_fragment_format.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_policy_fragment_format.py
new file mode 100644
index 000000000000..47c2820e0268
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_policy_fragment_format.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_policy_fragment_format.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy_fragment.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ id="policyFragment1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspacePolicyFragmentFormat.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_product.py
new file mode 100644
index 000000000000..c925605a3819
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_product.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_product.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="unlimited",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceProduct.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_product_api_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_product_api_link.py
new file mode 100644
index 000000000000..624fcaeb785d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_product_api_link.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_product_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_api_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ api_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceProductApiLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_product_group_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_product_group_link.py
new file mode 100644
index 000000000000..17eef11d2ff7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_product_group_link.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_product_group_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_group_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ group_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceProductGroupLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_product_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_product_policy.py
new file mode 100644
index 000000000000..7ae5793eb387
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_product_policy.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_product_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_policy.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="kjoshiarmTemplateProduct4",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceProductPolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_schema.py
new file mode 100644
index 000000000000..9279150599f3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_schema.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_schema.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_global_schema.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ schema_id="schema1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceSchema.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_subscription.py
new file mode 100644
index 000000000000..89926b0bb73d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_subscription.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_subscription.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_subscription.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="5931a769d8d14f0ad8ce13b8",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceSubscription.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_tag.py
new file mode 100644
index 000000000000..355c61876f7f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_tag.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_tag.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="59306a29e4bbd510dc24e5f9",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceTag.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_tag_api_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_tag_api_link.py
new file mode 100644
index 000000000000..8d791f037b17
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_tag_api_link.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_tag_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_api_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ api_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceTagApiLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_tag_operation_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_tag_operation_link.py
new file mode 100644
index 000000000000..740c339f4b9c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_tag_operation_link.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_tag_operation_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_operation_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ operation_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceTagOperationLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_tag_product_link.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_tag_product_link.py
new file mode 100644
index 000000000000..04372d207e23
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_tag_product_link.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_workspace_tag_product_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_product_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ product_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementGetWorkspaceTagProductLink.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api.py
index fa6a8254731f..6ef5f97886f1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_diagnostic.py
index 69e3d19e16a4..bfaf5f104896 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_diagnostic.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_diagnostic.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_diagnostic.get_entity_tag(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiDiagnostic.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApiDiagnostic.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue.py
index e14412375162..9cf3b2b3a1c8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue.get_entity_tag(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiIssue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApiIssue.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_attachment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_attachment.py
index dd109e0acd9d..ee1407547d08 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_attachment.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_attachment.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_attachment.get_entity_tag(
@@ -40,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiIssueAttachment.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApiIssueAttachment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_comment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_comment.py
index 0697ddcf1a14..018214f5f07b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_comment.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_issue_comment.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_comment.get_entity_tag(
@@ -40,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiIssueComment.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApiIssueComment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation.py
index 17b92ca7768b..597464457faf 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation.get_entity_tag(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiOperation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApiOperation.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_policy.py
index 823e15e466f5..4e41edcd6e9e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation_policy.get_entity_tag(
@@ -45,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiOperationPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApiOperationPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_tag.py
index 0abd86a040d2..e042fcdcbbac 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_operation_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get_entity_state_by_operation(
@@ -40,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiOperationTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApiOperationTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_policy.py
index 75c6a181138a..93428c7d4669 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_policy.get_entity_tag(
@@ -44,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApiPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_release.py
index 21010d3f5c22..3d0a1222f078 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_release.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_release.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_release.get_entity_tag(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiRelease.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApiRelease.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_schema.py
index bb17e74b3501..999bd5361b58 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_schema.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_schema.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_schema.get_entity_tag(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiSchema.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApiSchema.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag.py
index 59b2f956fcc6..fb3206600e5e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get_entity_state_by_api(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApiTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag_description.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag_description.py
index f7a78ea3b0ce..59294ce156f6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag_description.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_tag_description.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_tag_description.get_entity_tag(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiTagDescription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApiTagDescription.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_version_set.py
index 426a77bda173..623c8664866b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_version_set.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_version_set.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_version_set.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiVersionSet.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApiVersionSet.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_wiki.py
index 913a51103a25..9d83de5b3d66 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_wiki.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_api_wiki.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_wiki.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiWiki.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadApiWiki.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_authorization_server.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_authorization_server.py
index a381f0f36882..0d168f870c41 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_authorization_server.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_authorization_server.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_server.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadAuthorizationServer.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadAuthorizationServer.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_backend.py
index 83168b195f87..7423ae906118 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_backend.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_backend.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.backend.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadBackend.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadBackend.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_cache.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_cache.py
index 33ed80ec6736..ba3d09940bf3 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_cache.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_cache.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.cache.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadCache.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadCache.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_certificate.py
index 1c6fef00183e..83fcee34d5a1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_certificate.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_certificate.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.certificate.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadCertificate.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadCertificate.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_content_type_content_item.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_content_type_content_item.py
index 1fb26995b567..2b359aa437b4 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_content_type_content_item.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_content_type_content_item.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_item.get_entity_tag(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadContentTypeContentItem.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadContentTypeContentItem.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_delegation_settings.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_delegation_settings.py
index 07e61eb3e26a..2200f2cf03e0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_delegation_settings.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_delegation_settings.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.delegation_settings.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadDelegationSettings.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadDelegationSettings.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_diagnostic.py
index e0ff879c0cd0..b5d41a3cbea9 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_diagnostic.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_diagnostic.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.diagnostic.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadDiagnostic.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadDiagnostic.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_documentation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_documentation.py
index 4859e3c3ed1c..43c30061df86 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_documentation.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_documentation.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.documentation.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadDocumentation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadDocumentation.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_email_template.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_email_template.py
index c23c8798a09e..4e8f8f7b9128 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_email_template.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_email_template.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.email_template.get_entity_tag(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadEmailTemplate.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadEmailTemplate.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway.py
index fc825ecd2701..2c7cad434fb9 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadGateway.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadGateway.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_api.py
index 0b5d95a30e50..df93c22f4478 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_api.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_api.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_api.get_entity_tag(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadGatewayApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadGatewayApi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_certificate_authority.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_certificate_authority.py
index c39349f69bc3..f2edb7a36ba9 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_certificate_authority.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_certificate_authority.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_certificate_authority.get_entity_tag(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadGatewayCertificateAuthority.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadGatewayCertificateAuthority.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_hostname_configuration.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_hostname_configuration.py
index bd2985e38370..ea2ef05b3808 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_hostname_configuration.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_gateway_hostname_configuration.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_hostname_configuration.get_entity_tag(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadGatewayHostnameConfiguration.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadGatewayHostnameConfiguration.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_global_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_global_schema.py
index 73b5e9a755e0..0f75a0822042 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_global_schema.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_global_schema.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.global_schema.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadGlobalSchema.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadGlobalSchema.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver.py
index 8d3a703f247d..80f0e3152b3b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver.get_entity_tag(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadGraphQLApiResolver.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadGraphQLApiResolver.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver_policy.py
index b59b6c16f3d6..bca651df68d8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_graph_ql_api_resolver_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver_policy.get_entity_tag(
@@ -45,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadGraphQLApiResolverPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadGraphQLApiResolverPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group.py
index 09d777bbe89d..f35e52d152e2 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadGroup.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group_user.py
index 680f91adbf03..fe22c76b6929 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group_user.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_group_user.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group_user.check_entity_exists(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadGroupUser.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadGroupUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_identity_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_identity_provider.py
index 6f1a1e326fbc..9ce5f0a3fb94 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_identity_provider.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_identity_provider.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.identity_provider.get_entity_tag(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadIdentityProvider.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadIdentityProvider.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_logger.py
index d5df7d5035c9..950ca6dcab3d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_logger.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_logger.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.logger.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadLogger.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadLogger.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_named_value.py
index 308ae8c661d9..06efff0afe69 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_named_value.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_named_value.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadNamedValue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadNamedValue.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_email.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_email.py
index 22c3a914e3bc..12f26a843646 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_email.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_email.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification_recipient_email.check_entity_exists(
@@ -44,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadNotificationRecipientEmail.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadNotificationRecipientEmail.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_user.py
index 2d351234745b..6cd57585be37 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_user.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_notification_recipient_user.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification_recipient_user.check_entity_exists(
@@ -44,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadNotificationRecipientUser.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadNotificationRecipientUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_open_id_connect_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_open_id_connect_provider.py
index a2b5a4dd1e7e..efcbc0decfc9 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_open_id_connect_provider.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_open_id_connect_provider.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.open_id_connect_provider.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadOpenIdConnectProvider.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadOpenIdConnectProvider.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy.py
index a0f21c9c33de..11119ba4a526 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy.get_entity_tag(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_fragment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_fragment.py
index f5199c4e62a8..c9b31c85a726 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_fragment.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_fragment.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy_fragment.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadPolicyFragment.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadPolicyFragment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_restriction.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_restriction.py
new file mode 100644
index 000000000000..701a3995773e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_restriction.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_policy_restriction.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.policy_restriction.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ policy_restriction_id="policyRestriction1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadPolicyRestriction.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_config.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_config.py
index d76e767552f6..4a6851d6b97d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_config.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_config.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_config.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadPortalConfig.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadPortalConfig.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_revision.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_revision.py
index 6d5884bf6a1e..9960cc5ae82b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_revision.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_revision.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_revision.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadPortalRevision.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadPortalRevision.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product.py
index 8128364c4409..1633c46329ab 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadProduct.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadProduct.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_api.py
index 5d2984ffdd3f..779da5d0ed40 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_api.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_api.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_api.check_entity_exists(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadProductApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadProductApi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_group.py
index b5f96211110f..8a8bf641900a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_group.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_group.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_group.check_entity_exists(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadProductGroup.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadProductGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_policy.py
index e0fbf44a6d74..34ae65915645 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_policy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_policy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_policy.get_entity_tag(
@@ -44,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadProductPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadProductPolicy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_tag.py
index 5b579233fa9e..1e2e619734c7 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get_entity_state_by_product(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadProductTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadProductTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_wiki.py
index f477a3200d8a..f1c171f433fe 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_wiki.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_product_wiki.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_wiki.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadProductWiki.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadProductWiki.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_in_settings.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_in_settings.py
index 10568a84d4fb..905fb9857a74 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_in_settings.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_in_settings.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.sign_in_settings.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadSignInSettings.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadSignInSettings.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_up_settings.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_up_settings.py
index cf1fe60a58b2..c81b4d57d2dd 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_up_settings.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_sign_up_settings.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.sign_up_settings.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadSignUpSettings.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadSignUpSettings.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_subscription.py
index 7483cf7c7da2..6ea41256a5ea 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_subscription.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_subscription.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.subscription.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadSubscription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadSubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tag.py
index fae18a63cb73..de9354efc2b7 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tag.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get_entity_state(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tenant_access.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tenant_access.py
index fb0021a39194..2d1e97b46c2d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tenant_access.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_tenant_access.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_access.get_entity_tag(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadTenantAccess.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadTenantAccess.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_user.py
index b0c1433401bd..9baab811f4f2 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_user.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_user.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadUser.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace.py
new file mode 100644
index 000000000000..051554baa433
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspace.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api.py
new file mode 100644
index 000000000000..52c72c46a204
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_api.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d1f7558aa04f15146d9d8a",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceApi.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_diagnostic.py
new file mode 100644
index 000000000000..9892c1bfda78
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_diagnostic.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_api_diagnostic.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_diagnostic.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d1f7558aa04f15146d9d8a",
+ diagnostic_id="applicationinsights",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceApiDiagnostic.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_operation.py
new file mode 100644
index 000000000000..9cb830ab5551
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_operation.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_api_operation.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d2ef278aa04f0888cba3f3",
+ operation_id="57d2ef278aa04f0ad01d6cdc",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceApiOperation.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_operation_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_operation_policy.py
new file mode 100644
index 000000000000..026875c067f9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_operation_policy.py
@@ -0,0 +1,46 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_api_operation_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation_policy.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5600b539c53f5b0062040001",
+ operation_id="5600b53ac53f5b0062080006",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceApiOperationPolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_policy.py
new file mode 100644
index 000000000000..5beb201ee87f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_policy.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_api_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_policy.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d1f7558aa04f15146d9d8a",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceApiPolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_release.py
new file mode 100644
index 000000000000..11c094498f8e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_release.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_api_release.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_release.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="a1",
+ release_id="5a7cb545298324c53224a799",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceApiRelease.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_schema.py
new file mode 100644
index 000000000000..4e670652054d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_schema.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_api_schema.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_schema.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d1f7558aa04f15146d9d8a",
+ schema_id="ec12520d-9d48-4e7b-8f39-698ca2ac63f1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceApiSchema.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_version_set.py
new file mode 100644
index 000000000000..ad95705999b7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_version_set.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_api_version_set.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_version_set.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ version_set_id="vs1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceApiVersionSet.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_backend.py
new file mode 100644
index 000000000000..65b72278c236
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_backend.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_backend.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_backend.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ backend_id="sfbackend",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceBackend.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_certificate.py
new file mode 100644
index 000000000000..1ceca50ad072
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_certificate.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_certificate.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_certificate.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ certificate_id="templateCert1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceCertificate.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_diagnostic.py
new file mode 100644
index 000000000000..d9ff5aa2f088
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_diagnostic.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_diagnostic.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_diagnostic.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ diagnostic_id="applicationinsights",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceDiagnostic.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_group.py
new file mode 100644
index 000000000000..bf854a24c1f4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_group.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_group.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="59306a29e4bbd510dc24e5f9",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceGroup.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_group_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_group_user.py
new file mode 100644
index 000000000000..4cc1ec128177
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_group_user.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_group_user.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group_user.check_entity_exists(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="59306a29e4bbd510dc24e5f9",
+ user_id="5931a75ae4bbd512a88c680b",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceGroupUser.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_logger.py
new file mode 100644
index 000000000000..a88aa7866823
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_logger.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_logger.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_logger.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ logger_id="templateLogger",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceLogger.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_named_value.py
new file mode 100644
index 000000000000..9a1cb6e4429e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_named_value.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_named_value.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testarmTemplateproperties2",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceNamedValue.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_notification_recipient_email.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_notification_recipient_email.py
new file mode 100644
index 000000000000..d2fb0e736864
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_notification_recipient_email.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_notification_recipient_email.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification_recipient_email.check_entity_exists(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ email="contoso@live.com",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceNotificationRecipientEmail.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_notification_recipient_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_notification_recipient_user.py
new file mode 100644
index 000000000000..92d603b20e39
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_notification_recipient_user.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_notification_recipient_user.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification_recipient_user.check_entity_exists(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ user_id="576823d0a40f7e74ec07d642",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceNotificationRecipientUser.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_policy.py
new file mode 100644
index 000000000000..b0f564799e4d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_policy.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspacePolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_policy_fragment.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_policy_fragment.py
new file mode 100644
index 000000000000..c587e0381905
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_policy_fragment.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_policy_fragment.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy_fragment.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ id="policyFragment1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspacePolicyFragment.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_product.py
new file mode 100644
index 000000000000..bde7e6a6684e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_product.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_product.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="unlimited",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceProduct.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_product_policy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_product_policy.py
new file mode 100644
index 000000000000..c35336468331
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_product_policy.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_product_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_policy.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="unlimited",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceProductPolicy.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_schema.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_schema.py
new file mode 100644
index 000000000000..e1f221363923
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_schema.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_schema.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_global_schema.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ schema_id="myschema",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceSchema.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_subscription.py
new file mode 100644
index 000000000000..d0becc3f14fb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_subscription.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_subscription.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_subscription.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="5931a769d8d14f0ad8ce13b8",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceSubscription.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_tag.py
new file mode 100644
index 000000000000..42300967218f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_tag.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_workspace_tag.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag.get_entity_state(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="59306a29e4bbd510dc24e5f9",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementHeadWorkspaceTag.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_identity_provider_list_secrets.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_identity_provider_list_secrets.py
index 2facc7fa8b1d..d2a314919fee 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_identity_provider_list_secrets.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_identity_provider_list_secrets.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.identity_provider.list_secrets(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementIdentityProviderListSecrets.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementIdentityProviderListSecrets.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_diagnostics.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_diagnostics.py
index d6c4afa765b8..35331ea574e0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_diagnostics.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_diagnostics.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_diagnostic.list_by_service(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiDiagnostics.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiDiagnostics.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_attachments.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_attachments.py
index 028f3e5bb69f..dd9202c173c2 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_attachments.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_attachments.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_attachment.list_by_service(
@@ -40,6 +40,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiIssueAttachments.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiIssueAttachments.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_comments.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_comments.py
index 0613ed9f7d33..3426ad829b5f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_comments.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issue_comments.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_comment.list_by_service(
@@ -40,6 +40,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiIssueComments.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiIssueComments.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issues.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issues.py
index 507dd5fb22d6..4db6a3ade71c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issues.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_issues.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue.list_by_service(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiIssues.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiIssues.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_policies.py
index 0a9a739bcd87..29f16bb3eae5 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_policies.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_policies.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation_policy.list_by_operation(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiOperationPolicies.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiOperationPolicies.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_tags.py
index d723bb3acc6c..0a4eff9f7f12 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_tags.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operation_tags.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.list_by_operation(
@@ -40,6 +40,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiOperationTags.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiOperationTags.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations.py
index 4275c1480ef0..a3685c2da930 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation.list_by_api(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiOperations.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiOperations.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations_by_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations_by_tags.py
index 2f23352f070a..7916f3f85a1d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations_by_tags.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_operations_by_tags.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.operation.list_by_tags(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiOperationsByTags.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiOperationsByTags.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_policies.py
index 3516735fc869..9dd442753b00 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_policies.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_policies.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_policy.list_by_api(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiPolicies.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiPolicies.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_products.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_products.py
index e3a930d3935f..15712b45c021 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_products.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_products.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_product.list_by_apis(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiProducts.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiProducts.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_releases.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_releases.py
index 4b15b94f61f6..8d4609657891 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_releases.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_releases.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_release.list_by_service(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiReleases.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiReleases.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_revisions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_revisions.py
index 2dfa6ea8936e..b467b567633e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_revisions.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_revisions.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_revision.list_by_service(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiRevisions.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiRevisions.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_schemas.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_schemas.py
index 24d01b4f258e..b63caaa89fe2 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_schemas.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_schemas.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_schema.list_by_api(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiSchemas.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiSchemas.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tag_descriptions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tag_descriptions.py
index 7f53ed059ba6..d726a151750f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tag_descriptions.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tag_descriptions.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_tag_description.list_by_service(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiTagDescriptions.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiTagDescriptions.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tags.py
index 98a1c2650fcb..8ba9a06549c9 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tags.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_tags.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.list_by_api(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiTags.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiTags.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_version_sets.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_version_sets.py
index a2f2e10543f8..5df4e868f79d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_version_sets.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_version_sets.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_version_set.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiVersionSets.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiVersionSets.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_wikis.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_wikis.py
index c7cb321df789..6ab9b183c99e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_wikis.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_api_wikis.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_wikis.list(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiWikis.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApiWikis.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis.py
index f9ba5a26426c..0bd0bbec7ae9 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApis.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApis.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis_by_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis_by_tags.py
index f6c0cd1bf76e..e296caa134d9 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis_by_tags.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_apis_by_tags.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.list_by_tags(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApisByTags.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListApisByTags.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_access_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_access_policies.py
index ba363ea0c34a..b5fff4760ed1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_access_policies.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_access_policies.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_access_policy.list_by_authorization(
@@ -40,6 +40,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListAuthorizationAccessPolicies.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListAuthorizationAccessPolicies.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_providers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_providers.py
index 93418ac79c06..9d70622e4656 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_providers.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_providers.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_provider.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListAuthorizationProviders.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListAuthorizationProviders.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_servers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_servers.py
index 4943108d1217..5f80963cb253 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_servers.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorization_servers.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_server.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListAuthorizationServers.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListAuthorizationServers.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_auth_code.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_auth_code.py
index ad94b6768796..a1875bc8e288 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_auth_code.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_auth_code.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization.list_by_authorization_provider(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListAuthorizationsAuthCode.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListAuthorizationsAuthCode.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_client_cred.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_client_cred.py
index b9c47bc05a41..d436c9612d55 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_client_cred.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_authorizations_client_cred.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization.list_by_authorization_provider(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListAuthorizationsClientCred.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListAuthorizationsClientCred.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_backends.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_backends.py
index 4fc8de14793b..0e9ffb0369cb 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_backends.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_backends.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.backend.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListBackends.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListBackends.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_caches.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_caches.py
index c864c34d5eb9..c7452ef6e431 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_caches.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_caches.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.cache.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListCaches.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListCaches.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_certificates.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_certificates.py
index 62fa790b46f6..45fea12a8d61 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_certificates.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_certificates.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.certificate.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListCertificates.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListCertificates.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_type_content_items.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_type_content_items.py
index ae309fcc4a3e..14b587723fbb 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_type_content_items.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_type_content_items.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_item.list_by_service(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListContentTypeContentItems.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListContentTypeContentItems.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_types.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_types.py
index e142b2f6d775..a8f3a2a7a2ec 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_types.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_content_types.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_type.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListContentTypes.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListContentTypes.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_diagnostics.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_diagnostics.py
index 843a6f2ecaef..6be93418c2ed 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_diagnostics.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_diagnostics.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.diagnostic.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListDiagnostics.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListDiagnostics.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_documentations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_documentations.py
index 043faf3f6374..10ecc5a4e8fd 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_documentations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_documentations.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.documentation.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListDocumentations.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListDocumentations.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_apis.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_apis.py
index b18adfe2501f..f41dee02404d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_apis.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_apis.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_api.list_by_service(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListGatewayApis.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListGatewayApis.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_certificate_authorities.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_certificate_authorities.py
index aecf4e7e8b8c..cb38f66d9666 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_certificate_authorities.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_certificate_authorities.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_certificate_authority.list_by_service(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListGatewayCertificateAuthorities.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListGatewayCertificateAuthorities.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_config_connection.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_config_connection.py
new file mode 100644
index 000000000000..8c916760bbcb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_config_connection.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_gateway_config_connection.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_gateway_config_connection.list_by_gateway(
+ resource_group_name="rg1",
+ gateway_name="standard-gw-1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListGatewayConfigConnection.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_hostname_configurations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_hostname_configurations.py
index 560f429c02c4..79638b2a9343 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_hostname_configurations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateway_hostname_configurations.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_hostname_configuration.list_by_service(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListGatewayHostnameConfigurations.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListGatewayHostnameConfigurations.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateways.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateways.py
index 9a3f528f6656..e63280887561 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateways.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateways.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListGateways.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListGateways.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateways_by_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateways_by_subscription.py
new file mode 100644
index 000000000000..c7c465776de8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateways_by_subscription.py
@@ -0,0 +1,40 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_gateways_by_subscription.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_gateway.list()
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListGatewaysBySubscription.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateways_by_subscription_and_resource_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateways_by_subscription_and_resource_group.py
new file mode 100644
index 000000000000..85a242ffca2d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_gateways_by_subscription_and_resource_group.py
@@ -0,0 +1,42 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_gateways_by_subscription_and_resource_group.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_gateway.list_by_resource_group(
+ resource_group_name="rg1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListGatewaysBySubscriptionAndResourceGroup.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_global_schemas.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_global_schemas.py
index f5bfb7b8c982..87df9680fc6a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_global_schemas.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_global_schemas.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.global_schema.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListGlobalSchemas.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListGlobalSchemas.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolver_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolver_policies.py
index 6abd7a04e8c6..4e4ae45bf0a6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolver_policies.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolver_policies.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver_policy.list_by_resolver(
@@ -40,6 +40,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListGraphQLApiResolverPolicies.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListGraphQLApiResolverPolicies.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolvers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolvers.py
index 8897ad268cc5..d18cfe383b16 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolvers.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_graph_ql_api_resolvers.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver.list_by_api(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListGraphQLApiResolvers.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListGraphQLApiResolvers.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_group_users.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_group_users.py
index 4c021fed8439..47206353d935 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_group_users.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_group_users.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group_user.list(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListGroupUsers.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListGroupUsers.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_groups.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_groups.py
index 661f1ec95acf..be49b61dbe7f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_groups.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_groups.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListGroups.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListGroups.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_identity_providers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_identity_providers.py
index e9d72323e070..d582a412a956 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_identity_providers.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_identity_providers.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.identity_provider.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListIdentityProviders.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListIdentityProviders.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_issues.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_issues.py
index 51f1d04ba246..061f37a3be82 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_issues.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_issues.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.issue.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListIssues.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListIssues.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_loggers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_loggers.py
index f124c45afd6b..65f445128a5b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_loggers.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_loggers.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.logger.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListLoggers.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListLoggers.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_named_values.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_named_values.py
index 667b22252747..1478919a3acd 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_named_values.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_named_values.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListNamedValues.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListNamedValues.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_emails.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_emails.py
index a81cefe332df..fcbf90d987fe 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_emails.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_emails.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification_recipient_email.list_by_notification(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListNotificationRecipientEmails.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListNotificationRecipientEmails.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_users.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_users.py
index 857fdde80535..5c9f0e7ce7dc 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_users.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notification_recipient_users.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification_recipient_user.list_by_notification(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListNotificationRecipientUsers.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListNotificationRecipientUsers.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notifications.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notifications.py
index c6e56444c48a..29dd497680d3 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notifications.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_notifications.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListNotifications.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListNotifications.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_open_id_connect_providers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_open_id_connect_providers.py
index dcc745d70599..d8b1bc702165 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_open_id_connect_providers.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_open_id_connect_providers.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.open_id_connect_provider.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListOpenIdConnectProviders.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListOpenIdConnectProviders.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_operations.py
index 8e82f9843f5d..ae359fe5ce03 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_operations.py
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListOperations.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListOperations.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policies.py
index b30b3adebfca..a965b916aad0 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policies.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policies.py
@@ -27,16 +27,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy.list_by_service(
resource_group_name="rg1",
service_name="apimService1",
)
- print(response)
+ for item in response:
+ print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListPolicies.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListPolicies.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_descriptions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_descriptions.py
index eeec296c3f1d..c10de6a7219d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_descriptions.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_descriptions.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy_description.list_by_service(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListPolicyDescriptions.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListPolicyDescriptions.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragment_references.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragment_references.py
index 6b863fbd68d5..2aebe51cfda8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragment_references.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragment_references.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy_fragment.list_references(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListPolicyFragmentReferences.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListPolicyFragmentReferences.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragments.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragments.py
index 7b8cd130d0fc..f812c41db334 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragments.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_fragments.py
@@ -27,16 +27,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy_fragment.list_by_service(
resource_group_name="rg1",
service_name="apimService1",
)
- print(response)
+ for item in response:
+ print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListPolicyFragments.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListPolicyFragments.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_restrictions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_restrictions.py
new file mode 100644
index 000000000000..021976c67451
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_restrictions.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_policy_restrictions.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.policy_restriction.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListPolicyRestrictions.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_config.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_config.py
index 3885112fca62..7d99c2fdbb89 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_config.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_config.py
@@ -27,16 +27,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_config.list_by_service(
resource_group_name="rg1",
service_name="apimService1",
)
- print(response)
+ for item in response:
+ print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListPortalConfig.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListPortalConfig.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_revisions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_revisions.py
index 355335282beb..840214421241 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_revisions.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_revisions.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_revision.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListPortalRevisions.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListPortalRevisions.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_settings.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_settings.py
index bfc3ef7b3e5b..756053a8119b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_settings.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_settings.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_settings.list_by_service(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListPortalSettings.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListPortalSettings.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_endpoint_connections.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_endpoint_connections.py
index d722e2f97adf..a832efe1691e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_endpoint_connections.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_endpoint_connections.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.private_endpoint_connection.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListPrivateEndpointConnections.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListPrivateEndpointConnections.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_link_group_resources.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_link_group_resources.py
index 8b8351a061ce..1851fd7a9ee7 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_link_group_resources.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_private_link_group_resources.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.private_endpoint_connection.list_private_link_resources(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListPrivateLinkGroupResources.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListPrivateLinkGroupResources.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_api_links.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_api_links.py
new file mode 100644
index 000000000000..b7a7bc4b6c84
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_api_links.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_product_api_links.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.product_api_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ product_id="product1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListProductApiLinks.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_apis.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_apis.py
index 477e31e770f2..e67e6d20d582 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_apis.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_apis.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_api.list_by_product(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListProductApis.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListProductApis.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_group_links.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_group_links.py
new file mode 100644
index 000000000000..bc59b35d6c23
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_group_links.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_product_group_links.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.product_group_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ product_id="product1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListProductGroupLinks.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_groups.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_groups.py
index 01ba6e480e8d..23a03b20fa87 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_groups.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_groups.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_group.list_by_product(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListProductGroups.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListProductGroups.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_policies.py
index bff1ec50602a..5ff553be0f3c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_policies.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_policies.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_policy.list_by_product(
@@ -35,9 +35,10 @@ def main():
service_name="apimService1",
product_id="armTemplateProduct4",
)
- print(response)
+ for item in response:
+ print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListProductPolicies.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListProductPolicies.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_subscriptions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_subscriptions.py
index 1d807a54e9fe..cd8b1a8164c7 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_subscriptions.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_subscriptions.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_subscriptions.list(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListProductSubscriptions.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListProductSubscriptions.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_tags.py
index 710eeb77155e..20b2bc8c0d60 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_tags.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_tags.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.list_by_product(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListProductTags.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListProductTags.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_wikis.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_wikis.py
index 581fc5edceaf..bf415aa63cd1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_wikis.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_wikis.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_wikis.list(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListProductWikis.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListProductWikis.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products.py
index 22fb48f53ec8..4fed1cb8b887 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListProducts.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListProducts.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products_by_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products_by_tags.py
index 5a9b7fb28701..059922b27ef8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products_by_tags.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_products_by_tags.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product.list_by_tags(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListProductsByTags.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListProductsByTags.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_regions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_regions.py
index 4e3232ae12e3..1a34d18bff60 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_regions.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_regions.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.region.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListRegions.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListRegions.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_portal_settings_validation_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_portal_settings_validation_key.py
index 75a8d6c38bba..ae30ab530311 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_portal_settings_validation_key.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_portal_settings_validation_key.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.delegation_settings.list_secrets(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListSecretsPortalSettingsValidationKey.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListSecretsPortalSettingsValidationKey.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_tenant_access.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_tenant_access.py
index 8682f45bccd8..0a14b01fadc7 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_tenant_access.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_secrets_tenant_access.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_access.list_secrets(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListSecretsTenantAccess.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListSecretsTenantAccess.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription.py
index a9d5afd6db14..5697db4ecb03 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.list()
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListServiceBySubscription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListServiceBySubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription_and_resource_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription_and_resource_group.py
index 3f4c2440800f..f5716f447ff5 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription_and_resource_group.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_service_by_subscription_and_resource_group.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.list_by_resource_group(
@@ -37,6 +37,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListServiceBySubscriptionAndResourceGroup.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListServiceBySubscriptionAndResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_consumption.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_consumption.py
index d06fb654424c..ce98735ad5dd 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_consumption.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_consumption.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service_skus.list_available_service_skus(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListSKUs-Consumption.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListSKUs-Consumption.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_dedicated.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_dedicated.py
index b3e7739ec54f..b2e9b52a1ba8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_dedicated.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_dedicated.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service_skus.list_available_service_skus(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListSKUs-Dedicated.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListSKUs-Dedicated.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_gateways.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_gateways.py
new file mode 100644
index 000000000000..daccd6000dc0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sk_us_gateways.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_sk_us_gateways.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_management_gateway_skus.list_available_skus(
+ resource_group_name="rg1",
+ gateway_name="apimService1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListSKUs-Gateways.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sku.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sku.py
index 06fb9533d258..fd878dd2f34f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sku.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_sku.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_skus.list()
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListSku.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListSku.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_subscriptions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_subscriptions.py
index 02487b52d022..1f6e5d0d4b42 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_subscriptions.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_subscriptions.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.subscription.list(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListSubscriptions.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListSubscriptions.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_api_links.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_api_links.py
new file mode 100644
index 000000000000..1cac0a76bf18
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_api_links.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_tag_api_links.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_api_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListTagApiLinks.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_operation_links.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_operation_links.py
new file mode 100644
index 000000000000..08f9773f3d43
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_operation_links.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_tag_operation_links.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_operation_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListTagOperationLinks.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_product_links.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_product_links.py
new file mode 100644
index 000000000000..8ba2560bf85c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_product_links.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_tag_product_links.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_product_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListTagProductLinks.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_resources.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_resources.py
index 579d68457051..0f6d7a63e87d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_resources.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_resources.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag_resource.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListTagResources.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListTagResources.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tags.py
index 91997d0255df..f2605ffb684b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tags.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tags.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListTags.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListTags.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_templates.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_templates.py
index 234d61d90900..34478946268d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_templates.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_templates.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.email_template.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListTemplates.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListTemplates.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_access.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_access.py
index 221c8e8cde75..f161285d1749 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_access.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_access.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_access.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListTenantAccess.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListTenantAccess.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_settings.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_settings.py
index 85bf6cadb679..c39805af73c1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_settings.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tenant_settings.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_settings.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListTenantSettings.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListTenantSettings.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_groups.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_groups.py
index 25d259a6dce7..f8d1c4e10267 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_groups.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_groups.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user_group.list(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListUserGroups.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListUserGroups.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_identities.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_identities.py
index 5252b1600ef7..2bb264d60bc4 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_identities.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_identities.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user_identities.list(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListUserIdentities.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListUserIdentities.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_subscriptions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_subscriptions.py
index d3dd965a0c6d..250e58d46e1c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_subscriptions.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_user_subscriptions.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user_subscription.list(
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListUserSubscriptions.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListUserSubscriptions.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_users.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_users.py
index 9f381fda1fae..f44e6aae3c2e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_users.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_users.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListUsers.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListUsers.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_diagnostics.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_diagnostics.py
new file mode 100644
index 000000000000..f9c872b79b15
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_diagnostics.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_api_diagnostics.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_diagnostic.list_by_workspace(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="echo-api",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceApiDiagnostics.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_operation_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_operation_policies.py
new file mode 100644
index 000000000000..1cde38b724e3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_operation_policies.py
@@ -0,0 +1,46 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_api_operation_policies.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation_policy.list_by_operation(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="599e2953193c3c0bd0b3e2fa",
+ operation_id="599e29ab193c3c0bd0b3e2fb",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceApiOperationPolicies.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_operations.py
new file mode 100644
index 000000000000..5c750f94c7eb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_operations.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_api_operations.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation.list_by_api(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d2ef278aa04f0888cba3f3",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceApiOperations.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_policies.py
new file mode 100644
index 000000000000..a7750e084906
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_policies.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_api_policies.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_policy.list_by_api(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5600b59475ff190048040001",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceApiPolicies.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_releases.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_releases.py
new file mode 100644
index 000000000000..39f662cb2fbc
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_releases.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_api_releases.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_release.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="a1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceApiReleases.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_revisions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_revisions.py
new file mode 100644
index 000000000000..e8d38a822911
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_revisions.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_api_revisions.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_revision.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d2ef278aa04f0888cba3f3",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceApiRevisions.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_schemas.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_schemas.py
new file mode 100644
index 000000000000..5e63a97abeac
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_schemas.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_api_schemas.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_schema.list_by_api(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="59d5b28d1f7fab116c282650",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceApiSchemas.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_version_sets.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_version_sets.py
new file mode 100644
index 000000000000..61e49e737725
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_version_sets.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_api_version_sets.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_version_set.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceApiVersionSets.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_apis.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_apis.py
new file mode 100644
index 000000000000..4eb72ab730db
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_apis.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_apis.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceApis.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_backends.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_backends.py
new file mode 100644
index 000000000000..bcf1704eca01
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_backends.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_backends.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_backend.list_by_workspace(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceBackends.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_certificates.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_certificates.py
new file mode 100644
index 000000000000..a12b9424c434
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_certificates.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_certificates.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_certificate.list_by_workspace(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceCertificates.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_diagnostics.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_diagnostics.py
new file mode 100644
index 000000000000..5594be0564d7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_diagnostics.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_diagnostics.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_diagnostic.list_by_workspace(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceDiagnostics.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_group_users.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_group_users.py
new file mode 100644
index 000000000000..86ea6f663290
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_group_users.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_group_users.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group_user.list(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="57d2ef278aa04f0888cba3f3",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceGroupUsers.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_groups.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_groups.py
new file mode 100644
index 000000000000..b7a9afb4f518
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_groups.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_groups.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceGroups.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_links.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_links.py
new file mode 100644
index 000000000000..4afa6f4206d7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_links.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_links.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_management_workspace_links.list_by_service(
+ resource_group_name="rg1",
+ service_name="service1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceLinks.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_loggers.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_loggers.py
new file mode 100644
index 000000000000..050193dd972d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_loggers.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_loggers.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_logger.list_by_workspace(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceLoggers.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_named_values.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_named_values.py
new file mode 100644
index 000000000000..4250e8dfe9d0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_named_values.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_named_values.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceNamedValues.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_notification_recipient_emails.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_notification_recipient_emails.py
new file mode 100644
index 000000000000..c7f3d6c1af04
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_notification_recipient_emails.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_notification_recipient_emails.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification_recipient_email.list_by_notification(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceNotificationRecipientEmails.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_notification_recipient_users.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_notification_recipient_users.py
new file mode 100644
index 000000000000..913414230694
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_notification_recipient_users.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_notification_recipient_users.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification_recipient_user.list_by_notification(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceNotificationRecipientUsers.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_notifications.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_notifications.py
new file mode 100644
index 000000000000..a326d4f4d9d7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_notifications.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_notifications.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceNotifications.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_policies.py
new file mode 100644
index 000000000000..76dbeb9ad0f9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_policies.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_policies.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy.list_by_api(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspacePolicies.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_policy_fragment_references.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_policy_fragment_references.py
new file mode 100644
index 000000000000..ff05a988085b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_policy_fragment_references.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_policy_fragment_references.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy_fragment.list_references(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ id="policyFragment1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspacePolicyFragmentReferences.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_policy_fragments.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_policy_fragments.py
new file mode 100644
index 000000000000..27721388e354
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_policy_fragments.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_policy_fragments.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy_fragment.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspacePolicyFragments.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_product_api_links.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_product_api_links.py
new file mode 100644
index 000000000000..212e93e6defe
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_product_api_links.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_product_api_links.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_api_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="product1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceProductApiLinks.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_product_group_links.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_product_group_links.py
new file mode 100644
index 000000000000..96d3b0416d84
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_product_group_links.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_product_group_links.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_group_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="product1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceProductGroupLinks.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_product_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_product_policies.py
new file mode 100644
index 000000000000..e71a790005a4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_product_policies.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_product_policies.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_policy.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="armTemplateProduct4",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceProductPolicies.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_products.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_products.py
new file mode 100644
index 000000000000..7b7fdb4fa9c5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_products.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_products.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceProducts.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_schemas.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_schemas.py
new file mode 100644
index 000000000000..71488f5410b2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_schemas.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_schemas.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_global_schema.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceSchemas.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_subscriptions.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_subscriptions.py
new file mode 100644
index 000000000000..c106ebe03045
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_subscriptions.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_subscriptions.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_subscription.list(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceSubscriptions.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_tag_api_links.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_tag_api_links.py
new file mode 100644
index 000000000000..52c68dd4263f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_tag_api_links.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_tag_api_links.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_api_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceTagApiLinks.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_tag_operation_links.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_tag_operation_links.py
new file mode 100644
index 000000000000..961c7ee666f7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_tag_operation_links.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_tag_operation_links.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_operation_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceTagOperationLinks.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_tag_product_links.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_tag_product_links.py
new file mode 100644
index 000000000000..76481be61a60
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_tag_product_links.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_tag_product_links.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_product_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceTagProductLinks.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_tags.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_tags.py
new file mode 100644
index 000000000000..b5f3d2cf741c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_tags.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspace_tags.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaceTags.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspaces.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspaces.py
new file mode 100644
index 000000000000..4e80e6f9c12e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspaces.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_list_workspaces.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementListWorkspaces.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_named_value_list_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_named_value_list_value.py
index ee150813cbe9..21dddc05b22b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_named_value_list_value.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_named_value_list_value.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.list_value(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementNamedValueListValue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementNamedValueListValue.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_openid_connect_provider_list_secrets.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_openid_connect_provider_list_secrets.py
index bfbd905300d1..dad2ee32ca0d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_openid_connect_provider_list_secrets.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_openid_connect_provider_list_secrets.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.open_id_connect_provider.list_secrets(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementOpenidConnectProviderListSecrets.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementOpenidConnectProviderListSecrets.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check.py
index a00b17845dfb..3abbe5f73fc7 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.begin_perform_connectivity_check_async(
@@ -44,6 +42,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPerformConnectivityCheck.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementPerformConnectivityCheck.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check_http_connect.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check_http_connect.py
index cffdc12330b1..7705df24efc4 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check_http_connect.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_perform_connectivity_check_http_connect.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.begin_perform_connectivity_check_async(
@@ -40,7 +38,7 @@ def main():
"protocol": "HTTPS",
"protocolConfiguration": {
"HTTPConfiguration": {
- "headers": [{"name": "Authorization", "value": "******"}],
+ "headers": [{"name": "Authorization", "value": "Bearer myPreciousToken"}],
"method": "GET",
"validStatusCodes": [200, 204],
}
@@ -51,6 +49,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPerformConnectivityCheckHttpConnect.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementPerformConnectivityCheckHttpConnect.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_config.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_config.py
index 568b208200a4..b2a1ceff30d5 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_config.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_config.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_config.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPortalConfig.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementPortalConfig.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_delegation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_delegation.py
index 66df4dc06092..e6e329adecbc 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_delegation.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_delegation.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.delegation_settings.get(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPortalSettingsGetDelegation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementPortalSettingsGetDelegation.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_in.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_in.py
index 3c9c2cc22fe7..c3908e9cd55f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_in.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_in.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.sign_in_settings.get(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPortalSettingsGetSignIn.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementPortalSettingsGetSignIn.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_up.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_up.py
index 86c8505d0d81..dcb1a7627417 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_up.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_get_sign_up.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.sign_up_settings.get(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPortalSettingsGetSignUp.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementPortalSettingsGetSignUp.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_delegation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_delegation.py
index bd3604e4d281..8ad1360b72c7 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_delegation.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_delegation.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.delegation_settings.create_or_update(
@@ -47,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPortalSettingsPutDelegation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementPortalSettingsPutDelegation.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_in.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_in.py
index 5201e8aeee9f..fe7ee1a6faf8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_in.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_in.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.sign_in_settings.create_or_update(
@@ -40,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPortalSettingsPutSignIn.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementPortalSettingsPutSignIn.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_up.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_up.py
index 9f5e9b15ff25..c9d592a61dd8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_up.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_put_sign_up.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.sign_up_settings.create_or_update(
@@ -45,6 +43,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPortalSettingsPutSignUp.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementPortalSettingsPutSignUp.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_delegation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_delegation.py
index ea3c96d72e5d..d8a5e1670f98 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_delegation.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_delegation.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.delegation_settings.update(
@@ -47,6 +45,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPortalSettingsUpdateDelegation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementPortalSettingsUpdateDelegation.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_in.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_in.py
index f913bc93247d..a62af2aefddf 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_in.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_in.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.sign_in_settings.update(
@@ -40,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPortalSettingsUpdateSignIn.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementPortalSettingsUpdateSignIn.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_up.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_up.py
index 69879e9eca16..e6482e980439 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_up.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_portal_settings_update_sign_up.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.sign_up_settings.update(
@@ -45,6 +43,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPortalSettingsUpdateSignUp.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementPortalSettingsUpdateSignUp.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_post_authorization_confirm_consent_code_request.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_post_authorization_confirm_consent_code_request.py
index 328d4118b451..ce6df9e063f8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_post_authorization_confirm_consent_code_request.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_post_authorization_confirm_consent_code_request.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.authorization.confirm_consent_code(
@@ -41,6 +39,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementPostAuthorizationConfirmConsentCodeRequest.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementPostAuthorizationConfirmConsentCodeRequest.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_certificate.py
index 71ef66240ab9..c4a0d791571e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_certificate.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_certificate.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.certificate.refresh_secret(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementRefreshCertificate.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementRefreshCertificate.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_named_value.py
index 196df23c39fd..156abc849bb6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_named_value.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_named_value.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.begin_refresh_secret(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementRefreshNamedValue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementRefreshNamedValue.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_workspace_certificate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_workspace_certificate.py
new file mode 100644
index 000000000000..fb4b6bb8752e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_workspace_certificate.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_refresh_workspace_certificate.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_certificate.refresh_secret(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ certificate_id="templateCertkv",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementRefreshWorkspaceCertificate.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_workspace_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_workspace_named_value.py
new file mode 100644
index 000000000000..9b97f73eedd5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_workspace_named_value.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_refresh_workspace_named_value.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.begin_refresh_secret(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testprop2",
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementRefreshWorkspaceNamedValue.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_restore_with_access_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_restore_with_access_key.py
index 62b9421f8b7b..04979733a9a1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_restore_with_access_key.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_restore_with_access_key.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_restore(
@@ -46,6 +44,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementRestoreWithAccessKey.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementRestoreWithAccessKey.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_check_name_availability.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_check_name_availability.py
index 785a1a061d70..57064cc6140f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_check_name_availability.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_check_name_availability.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.check_name_availability(
@@ -38,6 +36,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementServiceCheckNameAvailability.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementServiceCheckNameAvailability.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_delete_service.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_delete_service.py
index c32838512adb..d54074514039 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_delete_service.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_delete_service.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_delete(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementServiceDeleteService.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementServiceDeleteService.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_domain_ownership_identifier.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_domain_ownership_identifier.py
index cfe6ebb855fd..dbcdfc003221 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_domain_ownership_identifier.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_domain_ownership_identifier.py
@@ -27,13 +27,13 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.get_domain_ownership_identifier()
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementServiceGetDomainOwnershipIdentifier.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementServiceGetDomainOwnershipIdentifier.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_multi_region_internal_vnet.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_multi_region_internal_vnet.py
index 0286e7688534..cd0ca9d1ef19 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_multi_region_internal_vnet.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_multi_region_internal_vnet.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.get(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementServiceGetMultiRegionInternalVnet.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementServiceGetMultiRegionInternalVnet.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status.py
index 19fb9e874cbe..c1e3e58101d8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.network_status.list_by_service(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementServiceGetNetworkStatus.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementServiceGetNetworkStatus.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status_by_location.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status_by_location.py
index db1a19e8aecb..6870afefd2ab 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status_by_location.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_network_status_by_location.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.network_status.list_by_location(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementServiceGetNetworkStatusByLocation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementServiceGetNetworkStatusByLocation.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_outbound_network_dependencies_endpoints.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_outbound_network_dependencies_endpoints.py
index 2ef99964f378..5a961b3ca47c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_outbound_network_dependencies_endpoints.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_outbound_network_dependencies_endpoints.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.outbound_network_dependencies_endpoints.list_by_service(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementServiceGetOutboundNetworkDependenciesEndpoints.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementServiceGetOutboundNetworkDependenciesEndpoints.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service.py
index 4b348f451501..673d8aba7f14 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.get(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementServiceGetService.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementServiceGetService.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service_having_msi.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service_having_msi.py
index f71ada140d68..a03a427f0969 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service_having_msi.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_service_having_msi.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.get(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementServiceGetServiceHavingMsi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementServiceGetServiceHavingMsi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_sso_token.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_sso_token.py
index d18ef5c92432..fde970acecc7 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_sso_token.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_get_sso_token.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.get_sso_token(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementServiceGetSsoToken.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementServiceGetSsoToken.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_migrate_to_stv2.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_migrate_to_stv2.py
index 0e114621f095..7de28209be6c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_migrate_to_stv2.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_service_migrate_to_stv2.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_migrate_to_stv2(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementServiceMigrateToStv2.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementServiceMigrateToStv2.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_list_secrets.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_list_secrets.py
index f5c18fc448cc..cd5fbbf1a570 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_list_secrets.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_list_secrets.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.subscription.list_secrets(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementSubscriptionListSecrets.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementSubscriptionListSecrets.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_primary_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_primary_key.py
index fa5212a2d339..67c2c7a6cc02 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_primary_key.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_primary_key.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.subscription.regenerate_primary_key(
@@ -37,6 +37,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementSubscriptionRegeneratePrimaryKey.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementSubscriptionRegeneratePrimaryKey.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_secondary_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_secondary_key.py
index 7ebcded6051f..0b74c84b3d4c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_secondary_key.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_subscription_regenerate_secondary_key.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.subscription.regenerate_secondary_key(
@@ -37,6 +37,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementSubscriptionRegenerateSecondaryKey.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementSubscriptionRegenerateSecondaryKey.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_regenerate_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_regenerate_key.py
index c23d7ebb6c38..88a71f71e191 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_regenerate_key.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_regenerate_key.py
@@ -6,15 +6,9 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -27,21 +21,19 @@
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
-
-
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- client.tenant_access.regenerate_primary_key(
- resource_group_name="rg1",
- service_name="apimService1",
- access_name="access",
+ client.tenant_access_git.regenerate_primary_key(
+ resource_group_name='rg1',
+ service_name='apimService1',
+ access_name='access',
)
-
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementTenantAccessRegenerateKey.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementTenantAccessRegenerateKey.json
if __name__ == "__main__":
main()
+)
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_sync_state.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_sync_state.py
index 38c4303f235e..a5572d95edc5 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_sync_state.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_access_sync_state.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_configuration.get_sync_state(
@@ -43,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementTenantAccessSyncState.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementTenantAccessSyncState.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_deploy.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_deploy.py
index a17270a566d3..df8c5abc1765 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_deploy.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_deploy.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_configuration.begin_deploy(
@@ -44,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementTenantConfigurationDeploy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementTenantConfigurationDeploy.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_save.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_save.py
index df73ed1b62c8..1d1099f63d95 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_save.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_save.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_configuration.begin_save(
@@ -44,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementTenantConfigurationSave.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementTenantConfigurationSave.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_validate.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_validate.py
index 425a450ba2aa..f293459ef12d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_validate.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_tenant_configuration_validate.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_configuration.begin_validate(
@@ -44,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementTenantConfigurationValidate.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementTenantConfigurationValidate.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_undelete.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_undelete.py
index 93b98fb0578b..e8958c5b2f60 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_undelete.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_undelete.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -44,6 +42,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUndelete.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUndelete.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api.py
index b62387ff8821..c1f533e36575 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.update(
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateApi.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_diagnostic.py
index 2dec0448301d..32e73f52e627 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_diagnostic.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_diagnostic.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_diagnostic.update(
@@ -57,6 +55,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateApiDiagnostic.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateApiDiagnostic.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_issue.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_issue.py
index 0309355512f9..1b872b1eecbe 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_issue.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_issue.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue.update(
@@ -43,6 +41,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateApiIssue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateApiIssue.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_operation.py
index 1cad1761aafe..6354ce9d7a90 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_operation.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_operation.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation.update(
@@ -66,6 +64,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateApiOperation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateApiOperation.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_release.py
index a05713216f09..68c12b65ccb7 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_release.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_release.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_release.update(
@@ -40,7 +38,7 @@ def main():
if_match="*",
parameters={
"properties": {
- "apiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1",
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1",
"notes": "yahooagain",
}
},
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateApiRelease.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateApiRelease.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_version_set.py
index f89a94dd896d..efc1c84b520b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_version_set.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_version_set.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_version_set.update(
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateApiVersionSet.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateApiVersionSet.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_wiki.py
index 41b37f6ef724..a75e78aad527 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_wiki.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_api_wiki.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_wiki.update(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateApiWiki.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateApiWiki.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_authorization_server.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_authorization_server.py
index 2df826b576f2..55c3d1e89bcc 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_authorization_server.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_authorization_server.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_server.update(
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateAuthorizationServer.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateAuthorizationServer.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_backend.py
index f2fff34cdfe5..d0920874895f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_backend.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_backend.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.backend.update(
@@ -47,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateBackend.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateBackend.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_cache.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_cache.py
index f79f8bddb287..07c691248032 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_cache.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_cache.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.cache.update(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateCache.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateCache.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_diagnostic.py
index 63676dc5cf4e..1125c82fb105 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_diagnostic.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_diagnostic.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.diagnostic.update(
@@ -56,6 +54,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateDiagnostic.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateDiagnostic.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_gateway.py
index 053bb01128cf..88b79deb31d5 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_gateway.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_gateway.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway.update(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateGateway.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateGateway.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_graph_ql_api_resolver.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_graph_ql_api_resolver.py
index 98a4a2a40682..b5e6e6ff17b8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_graph_ql_api_resolver.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_graph_ql_api_resolver.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver.update(
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateGraphQLApiResolver.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateGraphQLApiResolver.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_group.py
index f6aad0a5b93a..8c58fa9d2fe5 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_group.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_group.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group.update(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateGroup.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_identity_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_identity_provider.py
index b809574021ec..100417f07ce6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_identity_provider.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_identity_provider.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.identity_provider.update(
@@ -45,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateIdentityProvider.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateIdentityProvider.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_logger.py
index 43e8b40b5055..49e6b985ab74 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_logger.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_logger.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.logger.update(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateLogger.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateLogger.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_named_value.py
index 41f520132d27..369b1645cf28 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_named_value.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_named_value.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.begin_update(
@@ -44,6 +42,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateNamedValue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateNamedValue.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_open_id_connect_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_open_id_connect_provider.py
index 7caf92e028e4..38b136a137be 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_open_id_connect_provider.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_open_id_connect_provider.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.open_id_connect_provider.update(
@@ -44,6 +42,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateOpenIdConnectProvider.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateOpenIdConnectProvider.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_policy_restriction.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_policy_restriction.py
new file mode 100644
index 000000000000..b069620754ba
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_policy_restriction.py
@@ -0,0 +1,45 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_policy_restriction.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.policy_restriction.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ policy_restriction_id="policyRestriction1",
+ if_match="*",
+ parameters={"properties": {"scope": "Sample Path 2 to the policy document."}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdatePolicyRestriction.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_config.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_config.py
index a14363c85eef..80e0c4cf946c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_config.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_config.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_config.update(
@@ -62,6 +60,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdatePortalConfig.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdatePortalConfig.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_revision.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_revision.py
index 0db619110fb6..9b2700e0713e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_revision.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_revision.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_revision.begin_update(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdatePortalRevision.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdatePortalRevision.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product.py
index 5e850cf34b59..4c4af09305f3 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product.update(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateProduct.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateProduct.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product_wiki.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product_wiki.py
index cbbb850f1197..a14512cdd21e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product_wiki.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_product_wiki.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_wiki.update(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateProductWiki.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateProductWiki.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key.py
index ac1e33c817f2..ab8b6e0d9f96 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.quota_by_counter_keys.update(
@@ -41,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateQuotaCounterKey.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateQuotaCounterKey.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key_by_quota_period.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key_by_quota_period.py
index 5fd6073a3122..2bbfbf684a9c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key_by_quota_period.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_quota_counter_key_by_quota_period.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.quota_by_period_keys.update(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateQuotaCounterKeyByQuotaPeriod.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateQuotaCounterKeyByQuotaPeriod.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_disable_tls10.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_disable_tls10.py
index 1aaa74b23e27..0ff1c6794f3c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_disable_tls10.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_disable_tls10.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_update(
@@ -44,6 +42,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateServiceDisableTls10.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateServiceDisableTls10.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_publisher_details.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_publisher_details.py
index 1c62a6e4f282..9da5d35b27f3 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_publisher_details.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_publisher_details.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_update(
@@ -40,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateServicePublisherDetails.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateServicePublisherDetails.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_to_new_vnet_and_azs.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_to_new_vnet_and_azs.py
index 7e8ead831050..9cc3ad4799c1 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_to_new_vnet_and_azs.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_service_to_new_vnet_and_azs.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_update(
@@ -40,17 +38,17 @@ def main():
"additionalLocations": [
{
"location": "Australia East",
- "publicIpAddressId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/apim-australia-east-publicip",
+ "publicIpAddressId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/apim-australia-east-publicip",
"sku": {"capacity": 3, "name": "Premium"},
"virtualNetworkConfiguration": {
- "subnetResourceId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/apimaeavnet/subnets/default"
+ "subnetResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/apimaeavnet/subnets/default"
},
"zones": ["1", "2", "3"],
}
],
- "publicIpAddressId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/publicip-apim-japan-east",
+ "publicIpAddressId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/publicip-apim-japan-east",
"virtualNetworkConfiguration": {
- "subnetResourceId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-apim-japaneast/subnets/apim2"
+ "subnetResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-apim-japaneast/subnets/apim2"
},
"virtualNetworkType": "External",
},
@@ -61,6 +59,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateServiceToNewVnetAndAZs.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateServiceToNewVnetAndAZs.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_standard_gateway.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_standard_gateway.py
new file mode 100644
index 000000000000..e966ca18d79d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_standard_gateway.py
@@ -0,0 +1,47 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_standard_gateway.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_gateway.begin_update(
+ resource_group_name="rg1",
+ gateway_name="apimGateway1",
+ parameters={
+ "properties": {},
+ "sku": {"capacity": 10, "name": "Standard"},
+ "tags": {"Name": "Contoso", "Test": "User"},
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateStandardGateway.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_subscription.py
index 9a90e26e9643..966cc0226a73 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_subscription.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_subscription.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.subscription.update(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateSubscription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateSubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tag.py
index b483ffebed26..7c92061e23a5 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tag.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tag.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.update(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateTag.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_template.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_template.py
index 1ab5da896e91..81e59ee01520 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_template.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_template.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.email_template.update(
@@ -50,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateTemplate.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateTemplate.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tenant_access.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tenant_access.py
index 793ea5bfe6fe..1a23900ac876 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tenant_access.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_tenant_access.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -32,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_access.update(
@@ -45,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateTenantAccess.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateTenantAccess.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_user.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_user.py
index 20dd7fbfd2da..1e6ebf8f2481 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_user.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_user.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user.update(
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateUser.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_documentation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace.py
similarity index 77%
rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_documentation.py
rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace.py
index 577231e635df..55ecde8d14b5 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_documentation.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -17,7 +15,7 @@
pip install azure-identity
pip install azure-mgmt-apimanagement
# USAGE
- python api_management_update_documentation.py
+ python api_management_update_workspace.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
@@ -29,19 +27,19 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.documentation.update(
+ response = client.workspace.update(
resource_group_name="rg1",
service_name="apimService1",
- documentation_id="57d1f7558aa04f15146d9d8a",
+ workspace_id="wks1",
if_match="*",
- parameters={"properties": {"content": "content updated", "title": "Title updated"}},
+ parameters={"properties": {"description": "workspace 1", "displayName": "my workspace"}},
)
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUpdateDocumentation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateWorkspace.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api.py
new file mode 100644
index 000000000000..9d5f16be4aeb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api.py
@@ -0,0 +1,52 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_workspace_api.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="echo-api",
+ if_match="*",
+ parameters={
+ "properties": {
+ "displayName": "Echo API New",
+ "path": "newecho",
+ "serviceUrl": "http://echoapi.cloudapp.net/api2",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateWorkspaceApi.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api_diagnostic.py
new file mode 100644
index 000000000000..10fd5e84f0c0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api_diagnostic.py
@@ -0,0 +1,61 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_workspace_api_diagnostic.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_diagnostic.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="echo-api",
+ diagnostic_id="applicationinsights",
+ if_match="*",
+ parameters={
+ "properties": {
+ "alwaysLog": "allErrors",
+ "backend": {
+ "request": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ "response": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ },
+ "frontend": {
+ "request": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ "response": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ },
+ "loggerId": "/workspaces/wks1/loggers/applicationinsights",
+ "sampling": {"percentage": 50, "samplingType": "fixed"},
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateWorkspaceApiDiagnostic.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api_operation.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api_operation.py
new file mode 100644
index 000000000000..711413c39840
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api_operation.py
@@ -0,0 +1,70 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_workspace_api_operation.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="echo-api",
+ operation_id="operationId",
+ if_match="*",
+ parameters={
+ "properties": {
+ "displayName": "Retrieve resource",
+ "method": "GET",
+ "request": {
+ "queryParameters": [
+ {
+ "defaultValue": "sample",
+ "description": 'A sample parameter that is required and has a default value of "sample".',
+ "name": "param1",
+ "required": True,
+ "type": "string",
+ "values": ["sample"],
+ }
+ ]
+ },
+ "responses": [
+ {"description": "Returned in all cases.", "headers": [], "representations": [], "statusCode": 200},
+ {"description": "Server Error.", "headers": [], "representations": [], "statusCode": 500},
+ ],
+ "templateParameters": [],
+ "urlTemplate": "/resource",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateWorkspaceApiOperation.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api_release.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api_release.py
new file mode 100644
index 000000000000..3f58c792af97
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api_release.py
@@ -0,0 +1,52 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_workspace_api_release.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_release.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="a1",
+ release_id="testrev",
+ if_match="*",
+ parameters={
+ "properties": {
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/a1",
+ "notes": "yahooagain",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateWorkspaceApiRelease.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api_version_set.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api_version_set.py
new file mode 100644
index 000000000000..c754d8496c74
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api_version_set.py
@@ -0,0 +1,52 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_workspace_api_version_set.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_version_set.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ version_set_id="vs1",
+ if_match="*",
+ parameters={
+ "properties": {
+ "description": "Version configuration",
+ "displayName": "api set 1",
+ "versioningScheme": "Segment",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateWorkspaceApiVersionSet.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_backend.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_backend.py
new file mode 100644
index 000000000000..c2c85950589e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_backend.py
@@ -0,0 +1,51 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_workspace_backend.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_backend.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ backend_id="proxybackend",
+ if_match="*",
+ parameters={
+ "properties": {
+ "description": "description5308",
+ "tls": {"validateCertificateChain": False, "validateCertificateName": True},
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateWorkspaceBackend.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_diagnostic.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_diagnostic.py
new file mode 100644
index 000000000000..972c925778f6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_diagnostic.py
@@ -0,0 +1,60 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_workspace_diagnostic.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_diagnostic.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ diagnostic_id="applicationinsights",
+ if_match="*",
+ parameters={
+ "properties": {
+ "alwaysLog": "allErrors",
+ "backend": {
+ "request": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ "response": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ },
+ "frontend": {
+ "request": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ "response": {"body": {"bytes": 512}, "headers": ["Content-type"]},
+ },
+ "loggerId": "/workspaces/wks1/loggers/applicationinsights",
+ "sampling": {"percentage": 50, "samplingType": "fixed"},
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateWorkspaceDiagnostic.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_group.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_group.py
new file mode 100644
index 000000000000..99d8cb7bae16
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_group.py
@@ -0,0 +1,46 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_workspace_group.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="tempgroup",
+ if_match="*",
+ parameters={"properties": {"displayName": "temp group"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateWorkspaceGroup.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_logger.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_logger.py
new file mode 100644
index 000000000000..d2db6abed5ee
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_logger.py
@@ -0,0 +1,46 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_workspace_logger.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_logger.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ logger_id="eh1",
+ if_match="*",
+ parameters={"properties": {"description": "updating description", "loggerType": "azureEventHub"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateWorkspaceLogger.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_named_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_named_value.py
new file mode 100644
index 000000000000..c885e3af971a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_named_value.py
@@ -0,0 +1,48 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_workspace_named_value.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.begin_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testprop2",
+ if_match="*",
+ parameters={
+ "properties": {"displayName": "prop3name", "secret": False, "tags": ["foo", "bar2"], "value": "propValue"}
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateWorkspaceNamedValue.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_product.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_product.py
new file mode 100644
index 000000000000..743751a985c9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_product.py
@@ -0,0 +1,46 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_workspace_product.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ if_match="*",
+ parameters={"properties": {"displayName": "Test Template ProductName 4"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateWorkspaceProduct.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_subscription.py
new file mode 100644
index 000000000000..1780a9f7b25c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_subscription.py
@@ -0,0 +1,46 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_workspace_subscription.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_subscription.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="testsub",
+ if_match="*",
+ parameters={"properties": {"displayName": "testsub"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateWorkspaceSubscription.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_tag.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_tag.py
new file mode 100644
index 000000000000..61ea7aca5bb6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_tag.py
@@ -0,0 +1,46 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_workspace_tag.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="temptag",
+ if_match="*",
+ parameters={"properties": {"displayName": "temp tag"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUpdateWorkspaceTag.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_confirmation_password_send.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_confirmation_password_send.py
index 3a602061d599..f17c5d166ed2 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_confirmation_password_send.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_confirmation_password_send.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
client.user_confirmation_password.send(
@@ -37,6 +37,6 @@ def main():
)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUserConfirmationPasswordSend.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUserConfirmationPasswordSend.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_generate_sso_url.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_generate_sso_url.py
index f5075a26f8f9..d83b6baaf705 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_generate_sso_url.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_generate_sso_url.py
@@ -27,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user.generate_sso_url(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUserGenerateSsoUrl.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUserGenerateSsoUrl.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_token.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_token.py
index 83df805dfc9c..d3d5b409fe8b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_token.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_user_token.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -29,7 +27,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user.get_shared_access_token(
@@ -41,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementUserToken.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementUserToken.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_validate_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_validate_policies.py
new file mode 100644
index 000000000000..b524d3e6ec4d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_validate_policies.py
@@ -0,0 +1,42 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_validate_policies.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.policy_restriction_validations.begin_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementValidatePolicies.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_named_value_list_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_named_value_list_value.py
new file mode 100644
index 000000000000..229575e2bc7e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_named_value_list_value.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_workspace_named_value_list_value.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.list_value(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testarmTemplateproperties2",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementWorkspaceNamedValueListValue.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_subscription_list_secrets.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_subscription_list_secrets.py
new file mode 100644
index 000000000000..9531a22f2cf3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_subscription_list_secrets.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_workspace_subscription_list_secrets.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_subscription.list_secrets(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="5931a769d8d14f0ad8ce13b8",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementWorkspaceSubscriptionListSecrets.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_subscription_regenerate_primary_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_subscription_regenerate_primary_key.py
new file mode 100644
index 000000000000..901a153a1d54
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_subscription_regenerate_primary_key.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_workspace_subscription_regenerate_primary_key.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_subscription.regenerate_primary_key(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="testsub",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementWorkspaceSubscriptionRegeneratePrimaryKey.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_subscription_regenerate_secondary_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_subscription_regenerate_secondary_key.py
new file mode 100644
index 000000000000..b10cec1f794e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_subscription_regenerate_secondary_key.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_workspace_subscription_regenerate_secondary_key.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_subscription.regenerate_secondary_key(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="testsub",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2024-06-01-preview/examples/ApiManagementWorkspaceSubscriptionRegenerateSecondaryKey.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/conftest.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/conftest.py
new file mode 100644
index 000000000000..aee49742dee2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/conftest.py
@@ -0,0 +1,35 @@
+# 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 os
+import pytest
+from dotenv import load_dotenv
+from devtools_testutils import (
+ test_proxy,
+ add_general_regex_sanitizer,
+ add_body_key_sanitizer,
+ add_header_regex_sanitizer,
+)
+
+load_dotenv()
+
+
+# aovid record sensitive identity information in recordings
+@pytest.fixture(scope="session", autouse=True)
+def add_sanitizers(test_proxy):
+ apimanagement_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
+ apimanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
+ apimanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
+ apimanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=apimanagement_subscription_id, value="00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=apimanagement_tenant_id, value="00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=apimanagement_client_id, value="00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=apimanagement_client_secret, value="00000000-0000-0000-0000-000000000000")
+
+ add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
+ add_header_regex_sanitizer(key="Cookie", value="cookie;")
+ add_body_key_sanitizer(json_path="$..access_token", value="access_token")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management.py
new file mode 100644
index 000000000000..5242f7d72269
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management.py
@@ -0,0 +1,44 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagement(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_perform_connectivity_check_async(self, resource_group):
+ response = self.client.begin_perform_connectivity_check_async(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ connectivity_check_request_params={
+ "destination": {"address": "str", "port": 0},
+ "source": {"region": "str", "instance": 0},
+ "preferredIPVersion": "str",
+ "protocol": "str",
+ "protocolConfiguration": {
+ "HTTPConfiguration": {
+ "headers": [{"name": "str", "value": "str"}],
+ "method": "str",
+ "validStatusCodes": [0],
+ }
+ },
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_all_policies_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_all_policies_operations.py
new file mode 100644
index 000000000000..806794f40031
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_all_policies_operations.py
@@ -0,0 +1,31 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementAllPoliciesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.all_policies.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_all_policies_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_all_policies_operations_async.py
new file mode 100644
index 000000000000..6634ea160034
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_all_policies_operations_async.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementAllPoliciesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.all_policies.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_diagnostic_operations.py
new file mode 100644
index 000000000000..548b7b897044
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_diagnostic_operations.py
@@ -0,0 +1,212 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiDiagnosticOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.api_diagnostic.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.api_diagnostic.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_diagnostic.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.api_diagnostic.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ diagnostic_id="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "largeLanguageModel": {
+ "logs": "str",
+ "requests": {"maxSizeInBytes": 32768, "messages": "str"},
+ "responses": {"maxSizeInBytes": 32768, "messages": "str"},
+ },
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.api_diagnostic.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ diagnostic_id="str",
+ if_match="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "largeLanguageModel": {
+ "logs": "str",
+ "requests": {"maxSizeInBytes": 32768, "messages": "str"},
+ "responses": {"maxSizeInBytes": 32768, "messages": "str"},
+ },
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.api_diagnostic.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ diagnostic_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_diagnostic_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_diagnostic_operations_async.py
new file mode 100644
index 000000000000..3c527a44e677
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_diagnostic_operations_async.py
@@ -0,0 +1,213 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiDiagnosticOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.api_diagnostic.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.api_diagnostic.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_diagnostic.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.api_diagnostic.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ diagnostic_id="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "largeLanguageModel": {
+ "logs": "str",
+ "requests": {"maxSizeInBytes": 32768, "messages": "str"},
+ "responses": {"maxSizeInBytes": 32768, "messages": "str"},
+ },
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.api_diagnostic.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ diagnostic_id="str",
+ if_match="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "largeLanguageModel": {
+ "logs": "str",
+ "requests": {"maxSizeInBytes": 32768, "messages": "str"},
+ "responses": {"maxSizeInBytes": 32768, "messages": "str"},
+ },
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.api_diagnostic.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ diagnostic_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_export_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_export_operations.py
new file mode 100644
index 000000000000..05782d8dcfc8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_export_operations.py
@@ -0,0 +1,34 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiExportOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_export.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ format="str",
+ export="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_export_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_export_operations_async.py
new file mode 100644
index 000000000000..efb30057286d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_export_operations_async.py
@@ -0,0 +1,35 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiExportOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_export.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ format="str",
+ export="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_gateway_config_connection_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_gateway_config_connection_operations.py
new file mode 100644
index 000000000000..b60c0ff6389b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_gateway_config_connection_operations.py
@@ -0,0 +1,81 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiGatewayConfigConnectionOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_gateway(self, resource_group):
+ response = self.client.api_gateway_config_connection.list_by_gateway(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_gateway_config_connection.get(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ config_connection_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.api_gateway_config_connection.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ config_connection_name="str",
+ parameters={
+ "defaultHostname": "str",
+ "etag": "str",
+ "hostnames": ["str"],
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "sourceId": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_delete(self, resource_group):
+ response = self.client.api_gateway_config_connection.begin_delete(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ config_connection_name="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_gateway_config_connection_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_gateway_config_connection_operations_async.py
new file mode 100644
index 000000000000..9d87207dd67d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_gateway_config_connection_operations_async.py
@@ -0,0 +1,86 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiGatewayConfigConnectionOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_gateway(self, resource_group):
+ response = self.client.api_gateway_config_connection.list_by_gateway(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_gateway_config_connection.get(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ config_connection_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.api_gateway_config_connection.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ config_connection_name="str",
+ parameters={
+ "defaultHostname": "str",
+ "etag": "str",
+ "hostnames": ["str"],
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "sourceId": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_delete(self, resource_group):
+ response = await (
+ await self.client.api_gateway_config_connection.begin_delete(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ config_connection_name="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_gateway_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_gateway_operations.py
new file mode 100644
index 000000000000..a7b0eea5af34
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_gateway_operations.py
@@ -0,0 +1,127 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiGatewayOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.api_gateway.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ parameters={
+ "location": "str",
+ "sku": {"name": "str", "capacity": 0},
+ "backend": {"subnet": {"id": "str"}},
+ "configurationApi": {"hostname": "str"},
+ "createdAtUtc": "2020-02-20 00:00:00",
+ "etag": "str",
+ "frontend": {"defaultHostname": "str"},
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "tags": {"str": "str"},
+ "targetProvisioningState": "str",
+ "type": "str",
+ "virtualNetworkType": "str",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_update(self, resource_group):
+ response = self.client.api_gateway.begin_update(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ parameters={
+ "backend": {"subnet": {"id": "str"}},
+ "configurationApi": {"hostname": "str"},
+ "createdAtUtc": "2020-02-20 00:00:00",
+ "etag": "str",
+ "frontend": {"defaultHostname": "str"},
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "sku": {"capacity": 0, "name": "str"},
+ "tags": {"str": "str"},
+ "targetProvisioningState": "str",
+ "type": "str",
+ "virtualNetworkType": "str",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_gateway.get(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_delete(self, resource_group):
+ response = self.client.api_gateway.begin_delete(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_resource_group(self, resource_group):
+ response = self.client.api_gateway.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.api_gateway.list(
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_gateway_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_gateway_operations_async.py
new file mode 100644
index 000000000000..f47cfb3ee6e7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_gateway_operations_async.py
@@ -0,0 +1,134 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiGatewayOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.api_gateway.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ parameters={
+ "location": "str",
+ "sku": {"name": "str", "capacity": 0},
+ "backend": {"subnet": {"id": "str"}},
+ "configurationApi": {"hostname": "str"},
+ "createdAtUtc": "2020-02-20 00:00:00",
+ "etag": "str",
+ "frontend": {"defaultHostname": "str"},
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "tags": {"str": "str"},
+ "targetProvisioningState": "str",
+ "type": "str",
+ "virtualNetworkType": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_update(self, resource_group):
+ response = await (
+ await self.client.api_gateway.begin_update(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ parameters={
+ "backend": {"subnet": {"id": "str"}},
+ "configurationApi": {"hostname": "str"},
+ "createdAtUtc": "2020-02-20 00:00:00",
+ "etag": "str",
+ "frontend": {"defaultHostname": "str"},
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "sku": {"capacity": 0, "name": "str"},
+ "tags": {"str": "str"},
+ "targetProvisioningState": "str",
+ "type": "str",
+ "virtualNetworkType": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_gateway.get(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_delete(self, resource_group):
+ response = await (
+ await self.client.api_gateway.begin_delete(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_resource_group(self, resource_group):
+ response = self.client.api_gateway.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.api_gateway.list(
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_attachment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_attachment_operations.py
new file mode 100644
index 000000000000..858d1d7b5981
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_attachment_operations.py
@@ -0,0 +1,102 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiIssueAttachmentOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.api_issue_attachment.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.api_issue_attachment.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ attachment_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_issue_attachment.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ attachment_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.api_issue_attachment.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ attachment_id="str",
+ parameters={
+ "content": "str",
+ "contentFormat": "str",
+ "id": "str",
+ "name": "str",
+ "title": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.api_issue_attachment.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ attachment_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_attachment_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_attachment_operations_async.py
new file mode 100644
index 000000000000..8baacd721881
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_attachment_operations_async.py
@@ -0,0 +1,103 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiIssueAttachmentOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.api_issue_attachment.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.api_issue_attachment.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ attachment_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_issue_attachment.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ attachment_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.api_issue_attachment.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ attachment_id="str",
+ parameters={
+ "content": "str",
+ "contentFormat": "str",
+ "id": "str",
+ "name": "str",
+ "title": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.api_issue_attachment.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ attachment_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_comment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_comment_operations.py
new file mode 100644
index 000000000000..8931d71fd87c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_comment_operations.py
@@ -0,0 +1,102 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiIssueCommentOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.api_issue_comment.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.api_issue_comment.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ comment_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_issue_comment.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ comment_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.api_issue_comment.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ comment_id="str",
+ parameters={
+ "createdDate": "2020-02-20 00:00:00",
+ "id": "str",
+ "name": "str",
+ "text": "str",
+ "type": "str",
+ "userId": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.api_issue_comment.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ comment_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_comment_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_comment_operations_async.py
new file mode 100644
index 000000000000..7af06b204743
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_comment_operations_async.py
@@ -0,0 +1,103 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiIssueCommentOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.api_issue_comment.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.api_issue_comment.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ comment_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_issue_comment.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ comment_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.api_issue_comment.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ comment_id="str",
+ parameters={
+ "createdDate": "2020-02-20 00:00:00",
+ "id": "str",
+ "name": "str",
+ "text": "str",
+ "type": "str",
+ "userId": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.api_issue_comment.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ comment_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_operations.py
new file mode 100644
index 000000000000..bb0ea89fc978
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_operations.py
@@ -0,0 +1,123 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiIssueOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.api_issue.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.api_issue.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_issue.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.api_issue.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ parameters={
+ "apiId": "str",
+ "createdDate": "2020-02-20 00:00:00",
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "state": "str",
+ "title": "str",
+ "type": "str",
+ "userId": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.api_issue.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ if_match="str",
+ parameters={
+ "apiId": "str",
+ "createdDate": "2020-02-20 00:00:00",
+ "description": "str",
+ "state": "str",
+ "title": "str",
+ "userId": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.api_issue.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_operations_async.py
new file mode 100644
index 000000000000..c982a65297ce
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_issue_operations_async.py
@@ -0,0 +1,124 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiIssueOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.api_issue.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.api_issue.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_issue.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.api_issue.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ parameters={
+ "apiId": "str",
+ "createdDate": "2020-02-20 00:00:00",
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "state": "str",
+ "title": "str",
+ "type": "str",
+ "userId": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.api_issue.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ if_match="str",
+ parameters={
+ "apiId": "str",
+ "createdDate": "2020-02-20 00:00:00",
+ "description": "str",
+ "state": "str",
+ "title": "str",
+ "userId": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.api_issue.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ issue_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_gateway_skus_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_gateway_skus_operations.py
new file mode 100644
index 000000000000..f205ace20b58
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_gateway_skus_operations.py
@@ -0,0 +1,31 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiManagementGatewaySkusOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_available_skus(self, resource_group):
+ response = self.client.api_management_gateway_skus.list_available_skus(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_gateway_skus_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_gateway_skus_operations_async.py
new file mode 100644
index 000000000000..f198a1466975
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_gateway_skus_operations_async.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiManagementGatewaySkusOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_available_skus(self, resource_group):
+ response = self.client.api_management_gateway_skus.list_available_skus(
+ resource_group_name=resource_group.name,
+ gateway_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_operations_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_operations_operations.py
new file mode 100644
index 000000000000..cfcfc4582f6b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_operations_operations.py
@@ -0,0 +1,29 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiManagementOperationsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.api_management_operations.list(
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_operations_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_operations_operations_async.py
new file mode 100644
index 000000000000..c9ebd12ba67e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_operations_operations_async.py
@@ -0,0 +1,30 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiManagementOperationsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.api_management_operations.list(
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_service_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_service_operations.py
new file mode 100644
index 000000000000..a34956a0f468
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_service_operations.py
@@ -0,0 +1,400 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiManagementServiceOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_restore(self, resource_group):
+ response = self.client.api_management_service.begin_restore(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ parameters={
+ "backupName": "str",
+ "containerName": "str",
+ "storageAccount": "str",
+ "accessKey": "str",
+ "accessType": "AccessKey",
+ "clientId": "str",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_backup(self, resource_group):
+ response = self.client.api_management_service.begin_backup(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ parameters={
+ "backupName": "str",
+ "containerName": "str",
+ "storageAccount": "str",
+ "accessKey": "str",
+ "accessType": "AccessKey",
+ "clientId": "str",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.api_management_service.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ parameters={
+ "location": "str",
+ "publisherEmail": "str",
+ "publisherName": "str",
+ "sku": {"capacity": 0, "name": "str"},
+ "additionalLocations": [
+ {
+ "location": "str",
+ "sku": {"capacity": 0, "name": "str"},
+ "disableGateway": False,
+ "gatewayRegionalUrl": "str",
+ "natGatewayState": "str",
+ "outboundPublicIPAddresses": ["str"],
+ "platformVersion": "str",
+ "privateIPAddresses": ["str"],
+ "publicIPAddresses": ["str"],
+ "publicIpAddressId": "str",
+ "virtualNetworkConfiguration": {
+ "subnetResourceId": "str",
+ "subnetname": "str",
+ "vnetid": "str",
+ },
+ "zones": ["str"],
+ }
+ ],
+ "apiVersionConstraint": {"minApiVersion": "str"},
+ "certificates": [
+ {
+ "storeName": "str",
+ "certificate": {"expiry": "2020-02-20 00:00:00", "subject": "str", "thumbprint": "str"},
+ "certificatePassword": "str",
+ "encodedCertificate": "str",
+ }
+ ],
+ "configurationApi": {"legacyApi": "Enabled"},
+ "createdAtUtc": "2020-02-20 00:00:00",
+ "customProperties": {"str": "str"},
+ "developerPortalStatus": "Enabled",
+ "developerPortalUrl": "str",
+ "disableGateway": False,
+ "enableClientCertificate": False,
+ "etag": "str",
+ "gatewayRegionalUrl": "str",
+ "gatewayUrl": "str",
+ "hostnameConfigurations": [
+ {
+ "hostName": "str",
+ "type": "str",
+ "certificate": {"expiry": "2020-02-20 00:00:00", "subject": "str", "thumbprint": "str"},
+ "certificatePassword": "str",
+ "certificateSource": "str",
+ "certificateStatus": "str",
+ "defaultSslBinding": False,
+ "encodedCertificate": "str",
+ "identityClientId": "str",
+ "keyVaultId": "str",
+ "negotiateClientCertificate": False,
+ }
+ ],
+ "id": "str",
+ "identity": {
+ "type": "str",
+ "principalId": "str",
+ "tenantId": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "legacyPortalStatus": "Enabled",
+ "managementApiUrl": "str",
+ "name": "str",
+ "natGatewayState": "str",
+ "notificationSenderEmail": "str",
+ "outboundPublicIPAddresses": ["str"],
+ "platformVersion": "str",
+ "portalUrl": "str",
+ "privateEndpointConnections": [
+ {
+ "groupIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ }
+ ],
+ "privateIPAddresses": ["str"],
+ "provisioningState": "str",
+ "publicIPAddresses": ["str"],
+ "publicIpAddressId": "str",
+ "publicNetworkAccess": "str",
+ "releaseChannel": "str",
+ "restore": False,
+ "scmUrl": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "tags": {"str": "str"},
+ "targetProvisioningState": "str",
+ "type": "str",
+ "virtualNetworkConfiguration": {"subnetResourceId": "str", "subnetname": "str", "vnetid": "str"},
+ "virtualNetworkType": "str",
+ "zones": ["str"],
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_update(self, resource_group):
+ response = self.client.api_management_service.begin_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ parameters={
+ "additionalLocations": [
+ {
+ "location": "str",
+ "sku": {"capacity": 0, "name": "str"},
+ "disableGateway": False,
+ "gatewayRegionalUrl": "str",
+ "natGatewayState": "str",
+ "outboundPublicIPAddresses": ["str"],
+ "platformVersion": "str",
+ "privateIPAddresses": ["str"],
+ "publicIPAddresses": ["str"],
+ "publicIpAddressId": "str",
+ "virtualNetworkConfiguration": {
+ "subnetResourceId": "str",
+ "subnetname": "str",
+ "vnetid": "str",
+ },
+ "zones": ["str"],
+ }
+ ],
+ "apiVersionConstraint": {"minApiVersion": "str"},
+ "certificates": [
+ {
+ "storeName": "str",
+ "certificate": {"expiry": "2020-02-20 00:00:00", "subject": "str", "thumbprint": "str"},
+ "certificatePassword": "str",
+ "encodedCertificate": "str",
+ }
+ ],
+ "configurationApi": {"legacyApi": "Enabled"},
+ "createdAtUtc": "2020-02-20 00:00:00",
+ "customProperties": {"str": "str"},
+ "developerPortalStatus": "Enabled",
+ "developerPortalUrl": "str",
+ "disableGateway": False,
+ "enableClientCertificate": False,
+ "etag": "str",
+ "gatewayRegionalUrl": "str",
+ "gatewayUrl": "str",
+ "hostnameConfigurations": [
+ {
+ "hostName": "str",
+ "type": "str",
+ "certificate": {"expiry": "2020-02-20 00:00:00", "subject": "str", "thumbprint": "str"},
+ "certificatePassword": "str",
+ "certificateSource": "str",
+ "certificateStatus": "str",
+ "defaultSslBinding": False,
+ "encodedCertificate": "str",
+ "identityClientId": "str",
+ "keyVaultId": "str",
+ "negotiateClientCertificate": False,
+ }
+ ],
+ "id": "str",
+ "identity": {
+ "type": "str",
+ "principalId": "str",
+ "tenantId": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "legacyPortalStatus": "Enabled",
+ "managementApiUrl": "str",
+ "name": "str",
+ "natGatewayState": "str",
+ "notificationSenderEmail": "str",
+ "outboundPublicIPAddresses": ["str"],
+ "platformVersion": "str",
+ "portalUrl": "str",
+ "privateEndpointConnections": [
+ {
+ "groupIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ }
+ ],
+ "privateIPAddresses": ["str"],
+ "provisioningState": "str",
+ "publicIPAddresses": ["str"],
+ "publicIpAddressId": "str",
+ "publicNetworkAccess": "str",
+ "publisherEmail": "str",
+ "publisherName": "str",
+ "releaseChannel": "str",
+ "restore": False,
+ "scmUrl": "str",
+ "sku": {"capacity": 0, "name": "str"},
+ "tags": {"str": "str"},
+ "targetProvisioningState": "str",
+ "type": "str",
+ "virtualNetworkConfiguration": {"subnetResourceId": "str", "subnetname": "str", "vnetid": "str"},
+ "virtualNetworkType": "str",
+ "zones": ["str"],
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_management_service.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_delete(self, resource_group):
+ response = self.client.api_management_service.begin_delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_migrate_to_stv2(self, resource_group):
+ response = self.client.api_management_service.begin_migrate_to_stv2(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_resource_group(self, resource_group):
+ response = self.client.api_management_service.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.api_management_service.list(
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_sso_token(self, resource_group):
+ response = self.client.api_management_service.get_sso_token(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_check_name_availability(self, resource_group):
+ response = self.client.api_management_service.check_name_availability(
+ parameters={"name": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_domain_ownership_identifier(self, resource_group):
+ response = self.client.api_management_service.get_domain_ownership_identifier(
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_apply_network_configuration_updates(self, resource_group):
+ response = self.client.api_management_service.begin_apply_network_configuration_updates(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_service_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_service_operations_async.py
new file mode 100644
index 000000000000..3369b99b4a53
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_service_operations_async.py
@@ -0,0 +1,415 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiManagementServiceOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_restore(self, resource_group):
+ response = await (
+ await self.client.api_management_service.begin_restore(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ parameters={
+ "backupName": "str",
+ "containerName": "str",
+ "storageAccount": "str",
+ "accessKey": "str",
+ "accessType": "AccessKey",
+ "clientId": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_backup(self, resource_group):
+ response = await (
+ await self.client.api_management_service.begin_backup(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ parameters={
+ "backupName": "str",
+ "containerName": "str",
+ "storageAccount": "str",
+ "accessKey": "str",
+ "accessType": "AccessKey",
+ "clientId": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.api_management_service.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ parameters={
+ "location": "str",
+ "publisherEmail": "str",
+ "publisherName": "str",
+ "sku": {"capacity": 0, "name": "str"},
+ "additionalLocations": [
+ {
+ "location": "str",
+ "sku": {"capacity": 0, "name": "str"},
+ "disableGateway": False,
+ "gatewayRegionalUrl": "str",
+ "natGatewayState": "str",
+ "outboundPublicIPAddresses": ["str"],
+ "platformVersion": "str",
+ "privateIPAddresses": ["str"],
+ "publicIPAddresses": ["str"],
+ "publicIpAddressId": "str",
+ "virtualNetworkConfiguration": {
+ "subnetResourceId": "str",
+ "subnetname": "str",
+ "vnetid": "str",
+ },
+ "zones": ["str"],
+ }
+ ],
+ "apiVersionConstraint": {"minApiVersion": "str"},
+ "certificates": [
+ {
+ "storeName": "str",
+ "certificate": {"expiry": "2020-02-20 00:00:00", "subject": "str", "thumbprint": "str"},
+ "certificatePassword": "str",
+ "encodedCertificate": "str",
+ }
+ ],
+ "configurationApi": {"legacyApi": "Enabled"},
+ "createdAtUtc": "2020-02-20 00:00:00",
+ "customProperties": {"str": "str"},
+ "developerPortalStatus": "Enabled",
+ "developerPortalUrl": "str",
+ "disableGateway": False,
+ "enableClientCertificate": False,
+ "etag": "str",
+ "gatewayRegionalUrl": "str",
+ "gatewayUrl": "str",
+ "hostnameConfigurations": [
+ {
+ "hostName": "str",
+ "type": "str",
+ "certificate": {"expiry": "2020-02-20 00:00:00", "subject": "str", "thumbprint": "str"},
+ "certificatePassword": "str",
+ "certificateSource": "str",
+ "certificateStatus": "str",
+ "defaultSslBinding": False,
+ "encodedCertificate": "str",
+ "identityClientId": "str",
+ "keyVaultId": "str",
+ "negotiateClientCertificate": False,
+ }
+ ],
+ "id": "str",
+ "identity": {
+ "type": "str",
+ "principalId": "str",
+ "tenantId": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "legacyPortalStatus": "Enabled",
+ "managementApiUrl": "str",
+ "name": "str",
+ "natGatewayState": "str",
+ "notificationSenderEmail": "str",
+ "outboundPublicIPAddresses": ["str"],
+ "platformVersion": "str",
+ "portalUrl": "str",
+ "privateEndpointConnections": [
+ {
+ "groupIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ }
+ ],
+ "privateIPAddresses": ["str"],
+ "provisioningState": "str",
+ "publicIPAddresses": ["str"],
+ "publicIpAddressId": "str",
+ "publicNetworkAccess": "str",
+ "releaseChannel": "str",
+ "restore": False,
+ "scmUrl": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "tags": {"str": "str"},
+ "targetProvisioningState": "str",
+ "type": "str",
+ "virtualNetworkConfiguration": {"subnetResourceId": "str", "subnetname": "str", "vnetid": "str"},
+ "virtualNetworkType": "str",
+ "zones": ["str"],
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_update(self, resource_group):
+ response = await (
+ await self.client.api_management_service.begin_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ parameters={
+ "additionalLocations": [
+ {
+ "location": "str",
+ "sku": {"capacity": 0, "name": "str"},
+ "disableGateway": False,
+ "gatewayRegionalUrl": "str",
+ "natGatewayState": "str",
+ "outboundPublicIPAddresses": ["str"],
+ "platformVersion": "str",
+ "privateIPAddresses": ["str"],
+ "publicIPAddresses": ["str"],
+ "publicIpAddressId": "str",
+ "virtualNetworkConfiguration": {
+ "subnetResourceId": "str",
+ "subnetname": "str",
+ "vnetid": "str",
+ },
+ "zones": ["str"],
+ }
+ ],
+ "apiVersionConstraint": {"minApiVersion": "str"},
+ "certificates": [
+ {
+ "storeName": "str",
+ "certificate": {"expiry": "2020-02-20 00:00:00", "subject": "str", "thumbprint": "str"},
+ "certificatePassword": "str",
+ "encodedCertificate": "str",
+ }
+ ],
+ "configurationApi": {"legacyApi": "Enabled"},
+ "createdAtUtc": "2020-02-20 00:00:00",
+ "customProperties": {"str": "str"},
+ "developerPortalStatus": "Enabled",
+ "developerPortalUrl": "str",
+ "disableGateway": False,
+ "enableClientCertificate": False,
+ "etag": "str",
+ "gatewayRegionalUrl": "str",
+ "gatewayUrl": "str",
+ "hostnameConfigurations": [
+ {
+ "hostName": "str",
+ "type": "str",
+ "certificate": {"expiry": "2020-02-20 00:00:00", "subject": "str", "thumbprint": "str"},
+ "certificatePassword": "str",
+ "certificateSource": "str",
+ "certificateStatus": "str",
+ "defaultSslBinding": False,
+ "encodedCertificate": "str",
+ "identityClientId": "str",
+ "keyVaultId": "str",
+ "negotiateClientCertificate": False,
+ }
+ ],
+ "id": "str",
+ "identity": {
+ "type": "str",
+ "principalId": "str",
+ "tenantId": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "legacyPortalStatus": "Enabled",
+ "managementApiUrl": "str",
+ "name": "str",
+ "natGatewayState": "str",
+ "notificationSenderEmail": "str",
+ "outboundPublicIPAddresses": ["str"],
+ "platformVersion": "str",
+ "portalUrl": "str",
+ "privateEndpointConnections": [
+ {
+ "groupIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ }
+ ],
+ "privateIPAddresses": ["str"],
+ "provisioningState": "str",
+ "publicIPAddresses": ["str"],
+ "publicIpAddressId": "str",
+ "publicNetworkAccess": "str",
+ "publisherEmail": "str",
+ "publisherName": "str",
+ "releaseChannel": "str",
+ "restore": False,
+ "scmUrl": "str",
+ "sku": {"capacity": 0, "name": "str"},
+ "tags": {"str": "str"},
+ "targetProvisioningState": "str",
+ "type": "str",
+ "virtualNetworkConfiguration": {"subnetResourceId": "str", "subnetname": "str", "vnetid": "str"},
+ "virtualNetworkType": "str",
+ "zones": ["str"],
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_management_service.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_delete(self, resource_group):
+ response = await (
+ await self.client.api_management_service.begin_delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_migrate_to_stv2(self, resource_group):
+ response = await (
+ await self.client.api_management_service.begin_migrate_to_stv2(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_resource_group(self, resource_group):
+ response = self.client.api_management_service.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.api_management_service.list(
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_sso_token(self, resource_group):
+ response = await self.client.api_management_service.get_sso_token(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_check_name_availability(self, resource_group):
+ response = await self.client.api_management_service.check_name_availability(
+ parameters={"name": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_domain_ownership_identifier(self, resource_group):
+ response = await self.client.api_management_service.get_domain_ownership_identifier(
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_apply_network_configuration_updates(self, resource_group):
+ response = await (
+ await self.client.api_management_service.begin_apply_network_configuration_updates(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_service_skus_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_service_skus_operations.py
new file mode 100644
index 000000000000..e5c505b7302b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_service_skus_operations.py
@@ -0,0 +1,31 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiManagementServiceSkusOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_available_service_skus(self, resource_group):
+ response = self.client.api_management_service_skus.list_available_service_skus(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_service_skus_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_service_skus_operations_async.py
new file mode 100644
index 000000000000..890ddb3148ed
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_service_skus_operations_async.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiManagementServiceSkusOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_available_service_skus(self, resource_group):
+ response = self.client.api_management_service_skus.list_available_service_skus(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_skus_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_skus_operations.py
new file mode 100644
index 000000000000..1015023380ed
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_skus_operations.py
@@ -0,0 +1,29 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiManagementSkusOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.api_management_skus.list(
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_skus_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_skus_operations_async.py
new file mode 100644
index 000000000000..a9713f4ec20f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_skus_operations_async.py
@@ -0,0 +1,30 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiManagementSkusOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.api_management_skus.list(
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_workspace_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_workspace_link_operations.py
new file mode 100644
index 000000000000..d0e3b8a749e3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_workspace_link_operations.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiManagementWorkspaceLinkOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_management_workspace_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_workspace_link_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_workspace_link_operations_async.py
new file mode 100644
index 000000000000..7cb4c3a868b4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_workspace_link_operations_async.py
@@ -0,0 +1,33 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiManagementWorkspaceLinkOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_management_workspace_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_workspace_links_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_workspace_links_operations.py
new file mode 100644
index 000000000000..081f8946cb22
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_workspace_links_operations.py
@@ -0,0 +1,31 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiManagementWorkspaceLinksOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.api_management_workspace_links.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_workspace_links_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_workspace_links_operations_async.py
new file mode 100644
index 000000000000..b6d4ee23a617
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_management_workspace_links_operations_async.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiManagementWorkspaceLinksOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.api_management_workspace_links.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operation_operations.py
new file mode 100644
index 000000000000..042883bb1369
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operation_operations.py
@@ -0,0 +1,379 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiOperationOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_api(self, resource_group):
+ response = self.client.api_operation.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.api_operation.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_operation.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.api_operation.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "method": "str",
+ "name": "str",
+ "policies": "str",
+ "request": {
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "queryParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ },
+ "responses": [
+ {
+ "statusCode": 0,
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ }
+ ],
+ "templateParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "type": "str",
+ "urlTemplate": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.api_operation.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ if_match="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "method": "str",
+ "policies": "str",
+ "request": {
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "queryParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ },
+ "responses": [
+ {
+ "statusCode": 0,
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ }
+ ],
+ "templateParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "urlTemplate": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.api_operation.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operation_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operation_operations_async.py
new file mode 100644
index 000000000000..3f574590ad24
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operation_operations_async.py
@@ -0,0 +1,380 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiOperationOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_api(self, resource_group):
+ response = self.client.api_operation.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.api_operation.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_operation.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.api_operation.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "method": "str",
+ "name": "str",
+ "policies": "str",
+ "request": {
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "queryParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ },
+ "responses": [
+ {
+ "statusCode": 0,
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ }
+ ],
+ "templateParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "type": "str",
+ "urlTemplate": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.api_operation.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ if_match="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "method": "str",
+ "policies": "str",
+ "request": {
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "queryParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ },
+ "responses": [
+ {
+ "statusCode": 0,
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ }
+ ],
+ "templateParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "urlTemplate": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.api_operation.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operation_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operation_policy_operations.py
new file mode 100644
index 000000000000..afd9b88a22fe
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operation_policy_operations.py
@@ -0,0 +1,95 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiOperationPolicyOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_operation(self, resource_group):
+ response = self.client.api_operation_policy.list_by_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.api_operation_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_operation_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.api_operation_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.api_operation_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operation_policy_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operation_policy_operations_async.py
new file mode 100644
index 000000000000..e2be0158813d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operation_policy_operations_async.py
@@ -0,0 +1,96 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiOperationPolicyOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_operation(self, resource_group):
+ response = await self.client.api_operation_policy.list_by_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.api_operation_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_operation_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.api_operation_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.api_operation_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operations.py
new file mode 100644
index 000000000000..7d77918daf12
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operations.py
@@ -0,0 +1,177 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.api.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.api.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.api.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ parameters={
+ "apiRevision": "str",
+ "apiRevisionDescription": "str",
+ "apiType": "str",
+ "apiVersion": "str",
+ "apiVersionDescription": "str",
+ "apiVersionSet": {
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "versionHeaderName": "str",
+ "versionQueryName": "str",
+ "versioningScheme": "str",
+ },
+ "apiVersionSetId": "str",
+ "authenticationSettings": {
+ "oAuth2": {"authorizationServerId": "str", "scope": "str"},
+ "oAuth2AuthenticationSettings": [{"authorizationServerId": "str", "scope": "str"}],
+ "openid": {"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"},
+ "openidAuthenticationSettings": [{"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"}],
+ },
+ "contact": {"email": "str", "name": "str", "url": "str"},
+ "description": "str",
+ "displayName": "str",
+ "format": "str",
+ "isCurrent": bool,
+ "isOnline": bool,
+ "license": {"name": "str", "url": "str"},
+ "path": "str",
+ "protocols": ["str"],
+ "provisioningState": "str",
+ "serviceUrl": "str",
+ "sourceApiId": "str",
+ "subscriptionKeyParameterNames": {"header": "str", "query": "str"},
+ "subscriptionRequired": bool,
+ "termsOfServiceUrl": "str",
+ "translateRequiredQueryParameters": "str",
+ "type": "str",
+ "value": "str",
+ "wsdlSelector": {"wsdlEndpointName": "str", "wsdlServiceName": "str"},
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.api.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ if_match="str",
+ parameters={
+ "apiRevision": "str",
+ "apiRevisionDescription": "str",
+ "apiVersion": "str",
+ "apiVersionDescription": "str",
+ "apiVersionSetId": "str",
+ "authenticationSettings": {
+ "oAuth2": {"authorizationServerId": "str", "scope": "str"},
+ "oAuth2AuthenticationSettings": [{"authorizationServerId": "str", "scope": "str"}],
+ "openid": {"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"},
+ "openidAuthenticationSettings": [{"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"}],
+ },
+ "contact": {"email": "str", "name": "str", "url": "str"},
+ "description": "str",
+ "displayName": "str",
+ "isCurrent": bool,
+ "isOnline": bool,
+ "license": {"name": "str", "url": "str"},
+ "path": "str",
+ "protocols": ["str"],
+ "serviceUrl": "str",
+ "subscriptionKeyParameterNames": {"header": "str", "query": "str"},
+ "subscriptionRequired": bool,
+ "termsOfServiceUrl": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_delete(self, resource_group):
+ response = self.client.api.begin_delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_tags(self, resource_group):
+ response = self.client.api.list_by_tags(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operations_async.py
new file mode 100644
index 000000000000..514eac3b6463
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_operations_async.py
@@ -0,0 +1,184 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.api.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.api.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.api.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ parameters={
+ "apiRevision": "str",
+ "apiRevisionDescription": "str",
+ "apiType": "str",
+ "apiVersion": "str",
+ "apiVersionDescription": "str",
+ "apiVersionSet": {
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "versionHeaderName": "str",
+ "versionQueryName": "str",
+ "versioningScheme": "str",
+ },
+ "apiVersionSetId": "str",
+ "authenticationSettings": {
+ "oAuth2": {"authorizationServerId": "str", "scope": "str"},
+ "oAuth2AuthenticationSettings": [{"authorizationServerId": "str", "scope": "str"}],
+ "openid": {"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"},
+ "openidAuthenticationSettings": [
+ {"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"}
+ ],
+ },
+ "contact": {"email": "str", "name": "str", "url": "str"},
+ "description": "str",
+ "displayName": "str",
+ "format": "str",
+ "isCurrent": bool,
+ "isOnline": bool,
+ "license": {"name": "str", "url": "str"},
+ "path": "str",
+ "protocols": ["str"],
+ "provisioningState": "str",
+ "serviceUrl": "str",
+ "sourceApiId": "str",
+ "subscriptionKeyParameterNames": {"header": "str", "query": "str"},
+ "subscriptionRequired": bool,
+ "termsOfServiceUrl": "str",
+ "translateRequiredQueryParameters": "str",
+ "type": "str",
+ "value": "str",
+ "wsdlSelector": {"wsdlEndpointName": "str", "wsdlServiceName": "str"},
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.api.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ if_match="str",
+ parameters={
+ "apiRevision": "str",
+ "apiRevisionDescription": "str",
+ "apiVersion": "str",
+ "apiVersionDescription": "str",
+ "apiVersionSetId": "str",
+ "authenticationSettings": {
+ "oAuth2": {"authorizationServerId": "str", "scope": "str"},
+ "oAuth2AuthenticationSettings": [{"authorizationServerId": "str", "scope": "str"}],
+ "openid": {"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"},
+ "openidAuthenticationSettings": [{"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"}],
+ },
+ "contact": {"email": "str", "name": "str", "url": "str"},
+ "description": "str",
+ "displayName": "str",
+ "isCurrent": bool,
+ "isOnline": bool,
+ "license": {"name": "str", "url": "str"},
+ "path": "str",
+ "protocols": ["str"],
+ "serviceUrl": "str",
+ "subscriptionKeyParameterNames": {"header": "str", "query": "str"},
+ "subscriptionRequired": bool,
+ "termsOfServiceUrl": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_delete(self, resource_group):
+ response = await (
+ await self.client.api.begin_delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_tags(self, resource_group):
+ response = self.client.api.list_by_tags(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_policy_operations.py
new file mode 100644
index 000000000000..5ae159da6208
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_policy_operations.py
@@ -0,0 +1,90 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiPolicyOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_api(self, resource_group):
+ response = self.client.api_policy.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.api_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.api_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.api_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_policy_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_policy_operations_async.py
new file mode 100644
index 000000000000..61c8e6a0bbe0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_policy_operations_async.py
@@ -0,0 +1,91 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiPolicyOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_api(self, resource_group):
+ response = await self.client.api_policy.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.api_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.api_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.api_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_product_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_product_operations.py
new file mode 100644
index 000000000000..a3bddaa3e8a1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_product_operations.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiProductOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_apis(self, resource_group):
+ response = self.client.api_product.list_by_apis(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_product_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_product_operations_async.py
new file mode 100644
index 000000000000..e7733a1063a4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_product_operations_async.py
@@ -0,0 +1,33 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiProductOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_apis(self, resource_group):
+ response = self.client.api_product.list_by_apis(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_release_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_release_operations.py
new file mode 100644
index 000000000000..6eb5dc2f80df
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_release_operations.py
@@ -0,0 +1,122 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiReleaseOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.api_release.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.api_release.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ release_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_release.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ release_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.api_release.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ release_id="str",
+ parameters={
+ "apiId": "str",
+ "createdDateTime": "2020-02-20 00:00:00",
+ "id": "str",
+ "name": "str",
+ "notes": "str",
+ "type": "str",
+ "updatedDateTime": "2020-02-20 00:00:00",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.api_release.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ release_id="str",
+ if_match="str",
+ parameters={
+ "apiId": "str",
+ "createdDateTime": "2020-02-20 00:00:00",
+ "id": "str",
+ "name": "str",
+ "notes": "str",
+ "type": "str",
+ "updatedDateTime": "2020-02-20 00:00:00",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.api_release.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ release_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_release_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_release_operations_async.py
new file mode 100644
index 000000000000..c43c6118b359
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_release_operations_async.py
@@ -0,0 +1,123 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiReleaseOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.api_release.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.api_release.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ release_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_release.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ release_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.api_release.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ release_id="str",
+ parameters={
+ "apiId": "str",
+ "createdDateTime": "2020-02-20 00:00:00",
+ "id": "str",
+ "name": "str",
+ "notes": "str",
+ "type": "str",
+ "updatedDateTime": "2020-02-20 00:00:00",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.api_release.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ release_id="str",
+ if_match="str",
+ parameters={
+ "apiId": "str",
+ "createdDateTime": "2020-02-20 00:00:00",
+ "id": "str",
+ "name": "str",
+ "notes": "str",
+ "type": "str",
+ "updatedDateTime": "2020-02-20 00:00:00",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.api_release.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ release_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_revision_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_revision_operations.py
new file mode 100644
index 000000000000..919fbae0bda5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_revision_operations.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiRevisionOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.api_revision.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_revision_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_revision_operations_async.py
new file mode 100644
index 000000000000..33dfbd2c6440
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_revision_operations_async.py
@@ -0,0 +1,33 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiRevisionOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.api_revision.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_schema_operations.py
new file mode 100644
index 000000000000..1f8fd064fdaf
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_schema_operations.py
@@ -0,0 +1,99 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiSchemaOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_api(self, resource_group):
+ response = self.client.api_schema.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.api_schema.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_schema.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.api_schema.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ schema_id="str",
+ parameters={
+ "components": {},
+ "contentType": "str",
+ "definitions": {},
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "type": "str",
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.api_schema.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ schema_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_schema_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_schema_operations_async.py
new file mode 100644
index 000000000000..f0621c03a780
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_schema_operations_async.py
@@ -0,0 +1,102 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiSchemaOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_api(self, resource_group):
+ response = self.client.api_schema.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.api_schema.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_schema.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.api_schema.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ schema_id="str",
+ parameters={
+ "components": {},
+ "contentType": "str",
+ "definitions": {},
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "type": "str",
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.api_schema.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ schema_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_tag_description_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_tag_description_operations.py
new file mode 100644
index 000000000000..bf33cf8f1ff6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_tag_description_operations.py
@@ -0,0 +1,90 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiTagDescriptionOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.api_tag_description.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.api_tag_description.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_description_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_tag_description.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_description_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.api_tag_description.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_description_id="str",
+ parameters={"description": "str", "externalDocsDescription": "str", "externalDocsUrl": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.api_tag_description.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_description_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_tag_description_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_tag_description_operations_async.py
new file mode 100644
index 000000000000..471996e4c177
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_tag_description_operations_async.py
@@ -0,0 +1,91 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiTagDescriptionOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.api_tag_description.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.api_tag_description.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_description_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_tag_description.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_description_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.api_tag_description.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_description_id="str",
+ parameters={"description": "str", "externalDocsDescription": "str", "externalDocsUrl": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.api_tag_description.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_description_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_version_set_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_version_set_operations.py
new file mode 100644
index 000000000000..f93419d97fa2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_version_set_operations.py
@@ -0,0 +1,115 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiVersionSetOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.api_version_set.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.api_version_set.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ version_set_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_version_set.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ version_set_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.api_version_set.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ version_set_id="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "name": "str",
+ "type": "str",
+ "versionHeaderName": "str",
+ "versionQueryName": "str",
+ "versioningScheme": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.api_version_set.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ version_set_id="str",
+ if_match="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "versionHeaderName": "str",
+ "versionQueryName": "str",
+ "versioningScheme": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.api_version_set.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ version_set_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_version_set_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_version_set_operations_async.py
new file mode 100644
index 000000000000..f4ec7bf49e46
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_version_set_operations_async.py
@@ -0,0 +1,116 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiVersionSetOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.api_version_set.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.api_version_set.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ version_set_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_version_set.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ version_set_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.api_version_set.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ version_set_id="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "name": "str",
+ "type": "str",
+ "versionHeaderName": "str",
+ "versionQueryName": "str",
+ "versioningScheme": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.api_version_set.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ version_set_id="str",
+ if_match="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "versionHeaderName": "str",
+ "versionQueryName": "str",
+ "versioningScheme": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.api_version_set.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ version_set_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_wiki_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_wiki_operations.py
new file mode 100644
index 000000000000..446217d1513b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_wiki_operations.py
@@ -0,0 +1,88 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiWikiOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.api_wiki.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.api_wiki.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.api_wiki.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ parameters={"documents": [{"documentationId": "str"}], "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.api_wiki.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ if_match="str",
+ parameters={"documents": [{"documentationId": "str"}]},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.api_wiki.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_wiki_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_wiki_operations_async.py
new file mode 100644
index 000000000000..78f47d11f273
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_wiki_operations_async.py
@@ -0,0 +1,89 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiWikiOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.api_wiki.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.api_wiki.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.api_wiki.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ parameters={"documents": [{"documentationId": "str"}], "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.api_wiki.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ if_match="str",
+ parameters={"documents": [{"documentationId": "str"}]},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.api_wiki.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_wikis_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_wikis_operations.py
new file mode 100644
index 000000000000..999500cfd000
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_wikis_operations.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiWikisOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.api_wikis.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_wikis_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_wikis_operations_async.py
new file mode 100644
index 000000000000..b371b572bbc0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_api_wikis_operations_async.py
@@ -0,0 +1,33 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementApiWikisOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.api_wikis.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_async.py
new file mode 100644
index 000000000000..c02170b8d87f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_async.py
@@ -0,0 +1,47 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_perform_connectivity_check_async(self, resource_group):
+ response = await (
+ await self.client.begin_perform_connectivity_check_async(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ connectivity_check_request_params={
+ "destination": {"address": "str", "port": 0},
+ "source": {"region": "str", "instance": 0},
+ "preferredIPVersion": "str",
+ "protocol": "str",
+ "protocolConfiguration": {
+ "HTTPConfiguration": {
+ "headers": [{"name": "str", "value": "str"}],
+ "method": "str",
+ "validStatusCodes": [0],
+ }
+ },
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_access_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_access_policy_operations.py
new file mode 100644
index 000000000000..0285d7b42e5e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_access_policy_operations.py
@@ -0,0 +1,87 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementAuthorizationAccessPolicyOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_authorization(self, resource_group):
+ response = self.client.authorization_access_policy.list_by_authorization(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.authorization_access_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ authorization_access_policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.authorization_access_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ authorization_access_policy_id="str",
+ parameters={
+ "appIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "objectId": "str",
+ "tenantId": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.authorization_access_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ authorization_access_policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_access_policy_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_access_policy_operations_async.py
new file mode 100644
index 000000000000..f9ad5cd9a283
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_access_policy_operations_async.py
@@ -0,0 +1,88 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementAuthorizationAccessPolicyOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_authorization(self, resource_group):
+ response = self.client.authorization_access_policy.list_by_authorization(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.authorization_access_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ authorization_access_policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.authorization_access_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ authorization_access_policy_id="str",
+ parameters={
+ "appIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "objectId": "str",
+ "tenantId": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.authorization_access_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ authorization_access_policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_login_links_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_login_links_operations.py
new file mode 100644
index 000000000000..56ef3dc25a21
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_login_links_operations.py
@@ -0,0 +1,34 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementAuthorizationLoginLinksOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_post(self, resource_group):
+ response = self.client.authorization_login_links.post(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ parameters={"postLoginRedirectUrl": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_login_links_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_login_links_operations_async.py
new file mode 100644
index 000000000000..68208c01aaa0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_login_links_operations_async.py
@@ -0,0 +1,35 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementAuthorizationLoginLinksOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_post(self, resource_group):
+ response = await self.client.authorization_login_links.post(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ parameters={"postLoginRedirectUrl": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_operations.py
new file mode 100644
index 000000000000..739be023c50e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_operations.py
@@ -0,0 +1,100 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementAuthorizationOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_authorization_provider(self, resource_group):
+ response = self.client.authorization.list_by_authorization_provider(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.authorization.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.authorization.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ parameters={
+ "authorizationType": "str",
+ "error": {"code": "str", "message": "str"},
+ "id": "str",
+ "name": "str",
+ "oauth2grantType": "str",
+ "parameters": {"str": "str"},
+ "status": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.authorization.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_confirm_consent_code(self, resource_group):
+ response = self.client.authorization.confirm_consent_code(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ parameters={"consentCode": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_operations_async.py
new file mode 100644
index 000000000000..87c1a61c9f20
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_operations_async.py
@@ -0,0 +1,101 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementAuthorizationOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_authorization_provider(self, resource_group):
+ response = self.client.authorization.list_by_authorization_provider(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.authorization.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.authorization.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ parameters={
+ "authorizationType": "str",
+ "error": {"code": "str", "message": "str"},
+ "id": "str",
+ "name": "str",
+ "oauth2grantType": "str",
+ "parameters": {"str": "str"},
+ "status": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.authorization.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_confirm_consent_code(self, resource_group):
+ response = await self.client.authorization.confirm_consent_code(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ authorization_id="str",
+ parameters={"consentCode": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_provider_operations.py
new file mode 100644
index 000000000000..5fce5983b944
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_provider_operations.py
@@ -0,0 +1,82 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementAuthorizationProviderOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.authorization_provider.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.authorization_provider.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.authorization_provider.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ parameters={
+ "displayName": "str",
+ "id": "str",
+ "identityProvider": "str",
+ "name": "str",
+ "oauth2": {
+ "grantTypes": {"authorizationCode": {"str": "str"}, "clientCredentials": {"str": "str"}},
+ "redirectUrl": "str",
+ },
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.authorization_provider.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_provider_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_provider_operations_async.py
new file mode 100644
index 000000000000..55e64e78f091
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_provider_operations_async.py
@@ -0,0 +1,83 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementAuthorizationProviderOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.authorization_provider.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.authorization_provider.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.authorization_provider.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ parameters={
+ "displayName": "str",
+ "id": "str",
+ "identityProvider": "str",
+ "name": "str",
+ "oauth2": {
+ "grantTypes": {"authorizationCode": {"str": "str"}, "clientCredentials": {"str": "str"}},
+ "redirectUrl": "str",
+ },
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.authorization_provider.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authorization_provider_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_server_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_server_operations.py
new file mode 100644
index 000000000000..5b2e55e2a9bb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_server_operations.py
@@ -0,0 +1,157 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementAuthorizationServerOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.authorization_server.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.authorization_server.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authsid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.authorization_server.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authsid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.authorization_server.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authsid="str",
+ parameters={
+ "authorizationEndpoint": "str",
+ "authorizationMethods": ["str"],
+ "bearerTokenSendingMethods": ["str"],
+ "clientAuthenticationMethod": ["str"],
+ "clientId": "str",
+ "clientRegistrationEndpoint": "str",
+ "clientSecret": "str",
+ "defaultScope": "str",
+ "description": "str",
+ "displayName": "str",
+ "grantTypes": ["str"],
+ "id": "str",
+ "name": "str",
+ "resourceOwnerPassword": "str",
+ "resourceOwnerUsername": "str",
+ "supportState": bool,
+ "tokenBodyParameters": [{"name": "str", "value": "str"}],
+ "tokenEndpoint": "str",
+ "type": "str",
+ "useInApiDocumentation": bool,
+ "useInTestConsole": bool,
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.authorization_server.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authsid="str",
+ if_match="str",
+ parameters={
+ "authorizationEndpoint": "str",
+ "authorizationMethods": ["str"],
+ "bearerTokenSendingMethods": ["str"],
+ "clientAuthenticationMethod": ["str"],
+ "clientId": "str",
+ "clientRegistrationEndpoint": "str",
+ "clientSecret": "str",
+ "defaultScope": "str",
+ "description": "str",
+ "displayName": "str",
+ "grantTypes": ["str"],
+ "id": "str",
+ "name": "str",
+ "resourceOwnerPassword": "str",
+ "resourceOwnerUsername": "str",
+ "supportState": bool,
+ "tokenBodyParameters": [{"name": "str", "value": "str"}],
+ "tokenEndpoint": "str",
+ "type": "str",
+ "useInApiDocumentation": bool,
+ "useInTestConsole": bool,
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.authorization_server.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authsid="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_secrets(self, resource_group):
+ response = self.client.authorization_server.list_secrets(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authsid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_server_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_server_operations_async.py
new file mode 100644
index 000000000000..125444436b6f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_authorization_server_operations_async.py
@@ -0,0 +1,158 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementAuthorizationServerOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.authorization_server.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.authorization_server.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authsid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.authorization_server.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authsid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.authorization_server.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authsid="str",
+ parameters={
+ "authorizationEndpoint": "str",
+ "authorizationMethods": ["str"],
+ "bearerTokenSendingMethods": ["str"],
+ "clientAuthenticationMethod": ["str"],
+ "clientId": "str",
+ "clientRegistrationEndpoint": "str",
+ "clientSecret": "str",
+ "defaultScope": "str",
+ "description": "str",
+ "displayName": "str",
+ "grantTypes": ["str"],
+ "id": "str",
+ "name": "str",
+ "resourceOwnerPassword": "str",
+ "resourceOwnerUsername": "str",
+ "supportState": bool,
+ "tokenBodyParameters": [{"name": "str", "value": "str"}],
+ "tokenEndpoint": "str",
+ "type": "str",
+ "useInApiDocumentation": bool,
+ "useInTestConsole": bool,
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.authorization_server.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authsid="str",
+ if_match="str",
+ parameters={
+ "authorizationEndpoint": "str",
+ "authorizationMethods": ["str"],
+ "bearerTokenSendingMethods": ["str"],
+ "clientAuthenticationMethod": ["str"],
+ "clientId": "str",
+ "clientRegistrationEndpoint": "str",
+ "clientSecret": "str",
+ "defaultScope": "str",
+ "description": "str",
+ "displayName": "str",
+ "grantTypes": ["str"],
+ "id": "str",
+ "name": "str",
+ "resourceOwnerPassword": "str",
+ "resourceOwnerUsername": "str",
+ "supportState": bool,
+ "tokenBodyParameters": [{"name": "str", "value": "str"}],
+ "tokenEndpoint": "str",
+ "type": "str",
+ "useInApiDocumentation": bool,
+ "useInTestConsole": bool,
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.authorization_server.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authsid="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_secrets(self, resource_group):
+ response = await self.client.authorization_server.list_secrets(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ authsid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_backend_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_backend_operations.py
new file mode 100644
index 000000000000..8469ba7cec5a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_backend_operations.py
@@ -0,0 +1,201 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementBackendOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.backend.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.backend.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ backend_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.backend.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ backend_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.backend.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ backend_id="str",
+ parameters={
+ "circuitBreaker": {
+ "rules": [
+ {
+ "acceptRetryAfter": bool,
+ "failureCondition": {
+ "count": 0,
+ "errorReasons": ["str"],
+ "interval": "1 day, 0:00:00",
+ "percentage": 0,
+ "statusCodeRanges": [{"max": 0, "min": 0}],
+ },
+ "name": "str",
+ "tripDuration": "1 day, 0:00:00",
+ }
+ ]
+ },
+ "credentials": {
+ "authorization": {"parameter": "str", "scheme": "str"},
+ "certificate": ["str"],
+ "certificateIds": ["str"],
+ "header": {"str": ["str"]},
+ "query": {"str": ["str"]},
+ },
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "pool": {"services": [{"id": "str", "priority": 0, "weight": 0}]},
+ "properties": {
+ "serviceFabricCluster": {
+ "managementEndpoints": ["str"],
+ "clientCertificateId": "str",
+ "clientCertificatethumbprint": "str",
+ "maxPartitionResolutionRetries": 0,
+ "serverCertificateThumbprints": ["str"],
+ "serverX509Names": [{"issuerCertificateThumbprint": "str", "name": "str"}],
+ }
+ },
+ "protocol": "str",
+ "proxy": {"url": "str", "password": "str", "username": "str"},
+ "resourceId": "str",
+ "title": "str",
+ "tls": {"validateCertificateChain": True, "validateCertificateName": True},
+ "type": "str",
+ "url": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.backend.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ backend_id="str",
+ if_match="str",
+ parameters={
+ "circuitBreaker": {
+ "rules": [
+ {
+ "acceptRetryAfter": bool,
+ "failureCondition": {
+ "count": 0,
+ "errorReasons": ["str"],
+ "interval": "1 day, 0:00:00",
+ "percentage": 0,
+ "statusCodeRanges": [{"max": 0, "min": 0}],
+ },
+ "name": "str",
+ "tripDuration": "1 day, 0:00:00",
+ }
+ ]
+ },
+ "credentials": {
+ "authorization": {"parameter": "str", "scheme": "str"},
+ "certificate": ["str"],
+ "certificateIds": ["str"],
+ "header": {"str": ["str"]},
+ "query": {"str": ["str"]},
+ },
+ "description": "str",
+ "pool": {"services": [{"id": "str", "priority": 0, "weight": 0}]},
+ "properties": {
+ "serviceFabricCluster": {
+ "managementEndpoints": ["str"],
+ "clientCertificateId": "str",
+ "clientCertificatethumbprint": "str",
+ "maxPartitionResolutionRetries": 0,
+ "serverCertificateThumbprints": ["str"],
+ "serverX509Names": [{"issuerCertificateThumbprint": "str", "name": "str"}],
+ }
+ },
+ "protocol": "str",
+ "proxy": {"url": "str", "password": "str", "username": "str"},
+ "resourceId": "str",
+ "title": "str",
+ "tls": {"validateCertificateChain": True, "validateCertificateName": True},
+ "type": "str",
+ "url": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.backend.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ backend_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_reconnect(self, resource_group):
+ response = self.client.backend.reconnect(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ backend_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_backend_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_backend_operations_async.py
new file mode 100644
index 000000000000..f005ef51014f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_backend_operations_async.py
@@ -0,0 +1,202 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementBackendOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.backend.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.backend.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ backend_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.backend.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ backend_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.backend.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ backend_id="str",
+ parameters={
+ "circuitBreaker": {
+ "rules": [
+ {
+ "acceptRetryAfter": bool,
+ "failureCondition": {
+ "count": 0,
+ "errorReasons": ["str"],
+ "interval": "1 day, 0:00:00",
+ "percentage": 0,
+ "statusCodeRanges": [{"max": 0, "min": 0}],
+ },
+ "name": "str",
+ "tripDuration": "1 day, 0:00:00",
+ }
+ ]
+ },
+ "credentials": {
+ "authorization": {"parameter": "str", "scheme": "str"},
+ "certificate": ["str"],
+ "certificateIds": ["str"],
+ "header": {"str": ["str"]},
+ "query": {"str": ["str"]},
+ },
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "pool": {"services": [{"id": "str", "priority": 0, "weight": 0}]},
+ "properties": {
+ "serviceFabricCluster": {
+ "managementEndpoints": ["str"],
+ "clientCertificateId": "str",
+ "clientCertificatethumbprint": "str",
+ "maxPartitionResolutionRetries": 0,
+ "serverCertificateThumbprints": ["str"],
+ "serverX509Names": [{"issuerCertificateThumbprint": "str", "name": "str"}],
+ }
+ },
+ "protocol": "str",
+ "proxy": {"url": "str", "password": "str", "username": "str"},
+ "resourceId": "str",
+ "title": "str",
+ "tls": {"validateCertificateChain": True, "validateCertificateName": True},
+ "type": "str",
+ "url": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.backend.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ backend_id="str",
+ if_match="str",
+ parameters={
+ "circuitBreaker": {
+ "rules": [
+ {
+ "acceptRetryAfter": bool,
+ "failureCondition": {
+ "count": 0,
+ "errorReasons": ["str"],
+ "interval": "1 day, 0:00:00",
+ "percentage": 0,
+ "statusCodeRanges": [{"max": 0, "min": 0}],
+ },
+ "name": "str",
+ "tripDuration": "1 day, 0:00:00",
+ }
+ ]
+ },
+ "credentials": {
+ "authorization": {"parameter": "str", "scheme": "str"},
+ "certificate": ["str"],
+ "certificateIds": ["str"],
+ "header": {"str": ["str"]},
+ "query": {"str": ["str"]},
+ },
+ "description": "str",
+ "pool": {"services": [{"id": "str", "priority": 0, "weight": 0}]},
+ "properties": {
+ "serviceFabricCluster": {
+ "managementEndpoints": ["str"],
+ "clientCertificateId": "str",
+ "clientCertificatethumbprint": "str",
+ "maxPartitionResolutionRetries": 0,
+ "serverCertificateThumbprints": ["str"],
+ "serverX509Names": [{"issuerCertificateThumbprint": "str", "name": "str"}],
+ }
+ },
+ "protocol": "str",
+ "proxy": {"url": "str", "password": "str", "username": "str"},
+ "resourceId": "str",
+ "title": "str",
+ "tls": {"validateCertificateChain": True, "validateCertificateName": True},
+ "type": "str",
+ "url": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.backend.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ backend_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_reconnect(self, resource_group):
+ response = await self.client.backend.reconnect(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ backend_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_cache_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_cache_operations.py
new file mode 100644
index 000000000000..8ffc83da5b18
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_cache_operations.py
@@ -0,0 +1,108 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementCacheOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.cache.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.cache.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ cache_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.cache.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ cache_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.cache.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ cache_id="str",
+ parameters={
+ "connectionString": "str",
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "resourceId": "str",
+ "type": "str",
+ "useFromLocation": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.cache.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ cache_id="str",
+ if_match="str",
+ parameters={"connectionString": "str", "description": "str", "resourceId": "str", "useFromLocation": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.cache.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ cache_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_cache_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_cache_operations_async.py
new file mode 100644
index 000000000000..1816b76ef939
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_cache_operations_async.py
@@ -0,0 +1,109 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementCacheOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.cache.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.cache.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ cache_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.cache.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ cache_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.cache.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ cache_id="str",
+ parameters={
+ "connectionString": "str",
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "resourceId": "str",
+ "type": "str",
+ "useFromLocation": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.cache.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ cache_id="str",
+ if_match="str",
+ parameters={"connectionString": "str", "description": "str", "resourceId": "str", "useFromLocation": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.cache.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ cache_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_certificate_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_certificate_operations.py
new file mode 100644
index 000000000000..34a9717957dc
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_certificate_operations.py
@@ -0,0 +1,102 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementCertificateOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.certificate.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.certificate.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.certificate.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.certificate.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ certificate_id="str",
+ parameters={
+ "data": "str",
+ "keyVault": {"identityClientId": "str", "secretIdentifier": "str"},
+ "password": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.certificate.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ certificate_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_refresh_secret(self, resource_group):
+ response = self.client.certificate.refresh_secret(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_certificate_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_certificate_operations_async.py
new file mode 100644
index 000000000000..c4101593caa0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_certificate_operations_async.py
@@ -0,0 +1,103 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementCertificateOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.certificate.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.certificate.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.certificate.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.certificate.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ certificate_id="str",
+ parameters={
+ "data": "str",
+ "keyVault": {"identityClientId": "str", "secretIdentifier": "str"},
+ "password": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.certificate.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ certificate_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_refresh_secret(self, resource_group):
+ response = await self.client.certificate.refresh_secret(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_content_item_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_content_item_operations.py
new file mode 100644
index 000000000000..cbb5ee5ac614
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_content_item_operations.py
@@ -0,0 +1,90 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementContentItemOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.content_item.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.content_item.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ content_item_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.content_item.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ content_item_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.content_item.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ content_item_id="str",
+ parameters={"id": "str", "name": "str", "properties": {"str": {}}, "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.content_item.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ content_item_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_content_item_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_content_item_operations_async.py
new file mode 100644
index 000000000000..86b25045e75a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_content_item_operations_async.py
@@ -0,0 +1,91 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementContentItemOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.content_item.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.content_item.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ content_item_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.content_item.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ content_item_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.content_item.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ content_item_id="str",
+ parameters={"id": "str", "name": "str", "properties": {"str": {}}, "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.content_item.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ content_item_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_content_type_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_content_type_operations.py
new file mode 100644
index 000000000000..0cb2daefba41
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_content_type_operations.py
@@ -0,0 +1,79 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementContentTypeOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.content_type.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.content_type.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.content_type.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ parameters={
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "schema": {},
+ "type": "str",
+ "version": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.content_type.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_content_type_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_content_type_operations_async.py
new file mode 100644
index 000000000000..eca86777955e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_content_type_operations_async.py
@@ -0,0 +1,80 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementContentTypeOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.content_type.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.content_type.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.content_type.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ parameters={
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "schema": {},
+ "type": "str",
+ "version": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.content_type.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ content_type_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_delegation_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_delegation_settings_operations.py
new file mode 100644
index 000000000000..f5cd4e4f6bc5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_delegation_settings_operations.py
@@ -0,0 +1,98 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementDelegationSettingsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.delegation_settings.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.delegation_settings.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.delegation_settings.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ if_match="str",
+ parameters={
+ "id": "str",
+ "name": "str",
+ "subscriptions": {"enabled": bool},
+ "type": "str",
+ "url": "str",
+ "userRegistration": {"enabled": bool},
+ "validationKey": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.delegation_settings.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ parameters={
+ "id": "str",
+ "name": "str",
+ "subscriptions": {"enabled": bool},
+ "type": "str",
+ "url": "str",
+ "userRegistration": {"enabled": bool},
+ "validationKey": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_secrets(self, resource_group):
+ response = self.client.delegation_settings.list_secrets(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_delegation_settings_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_delegation_settings_operations_async.py
new file mode 100644
index 000000000000..c9fe98500780
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_delegation_settings_operations_async.py
@@ -0,0 +1,99 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementDelegationSettingsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.delegation_settings.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.delegation_settings.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.delegation_settings.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ if_match="str",
+ parameters={
+ "id": "str",
+ "name": "str",
+ "subscriptions": {"enabled": bool},
+ "type": "str",
+ "url": "str",
+ "userRegistration": {"enabled": bool},
+ "validationKey": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.delegation_settings.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ parameters={
+ "id": "str",
+ "name": "str",
+ "subscriptions": {"enabled": bool},
+ "type": "str",
+ "url": "str",
+ "userRegistration": {"enabled": bool},
+ "validationKey": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_secrets(self, resource_group):
+ response = await self.client.delegation_settings.list_secrets(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_deleted_services_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_deleted_services_operations.py
new file mode 100644
index 000000000000..1780c69261b2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_deleted_services_operations.py
@@ -0,0 +1,53 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementDeletedServicesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_subscription(self, resource_group):
+ response = self.client.deleted_services.list_by_subscription(
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_by_name(self, resource_group):
+ response = self.client.deleted_services.get_by_name(
+ service_name="str",
+ location="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_purge(self, resource_group):
+ response = self.client.deleted_services.begin_purge(
+ service_name="str",
+ location="str",
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_deleted_services_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_deleted_services_operations_async.py
new file mode 100644
index 000000000000..8300a0183831
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_deleted_services_operations_async.py
@@ -0,0 +1,56 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementDeletedServicesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_subscription(self, resource_group):
+ response = self.client.deleted_services.list_by_subscription(
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_by_name(self, resource_group):
+ response = await self.client.deleted_services.get_by_name(
+ service_name="str",
+ location="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_purge(self, resource_group):
+ response = await (
+ await self.client.deleted_services.begin_purge(
+ service_name="str",
+ location="str",
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_diagnostic_operations.py
new file mode 100644
index 000000000000..8ba35ce803d4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_diagnostic_operations.py
@@ -0,0 +1,206 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementDiagnosticOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.diagnostic.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.diagnostic.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.diagnostic.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.diagnostic.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ diagnostic_id="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "largeLanguageModel": {
+ "logs": "str",
+ "requests": {"maxSizeInBytes": 32768, "messages": "str"},
+ "responses": {"maxSizeInBytes": 32768, "messages": "str"},
+ },
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.diagnostic.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ diagnostic_id="str",
+ if_match="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "largeLanguageModel": {
+ "logs": "str",
+ "requests": {"maxSizeInBytes": 32768, "messages": "str"},
+ "responses": {"maxSizeInBytes": 32768, "messages": "str"},
+ },
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.diagnostic.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ diagnostic_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_diagnostic_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_diagnostic_operations_async.py
new file mode 100644
index 000000000000..0866af058167
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_diagnostic_operations_async.py
@@ -0,0 +1,207 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementDiagnosticOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.diagnostic.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.diagnostic.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.diagnostic.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.diagnostic.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ diagnostic_id="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "largeLanguageModel": {
+ "logs": "str",
+ "requests": {"maxSizeInBytes": 32768, "messages": "str"},
+ "responses": {"maxSizeInBytes": 32768, "messages": "str"},
+ },
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.diagnostic.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ diagnostic_id="str",
+ if_match="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "largeLanguageModel": {
+ "logs": "str",
+ "requests": {"maxSizeInBytes": 32768, "messages": "str"},
+ "responses": {"maxSizeInBytes": 32768, "messages": "str"},
+ },
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.diagnostic.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ diagnostic_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_documentation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_documentation_operations.py
new file mode 100644
index 000000000000..1dee5aadf381
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_documentation_operations.py
@@ -0,0 +1,100 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementDocumentationOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.documentation.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.documentation.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ documentation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.documentation.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ documentation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.documentation.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ documentation_id="str",
+ parameters={"content": "str", "id": "str", "name": "str", "title": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.documentation.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ documentation_id="str",
+ if_match="str",
+ parameters={"content": "str", "title": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.documentation.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ documentation_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_documentation_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_documentation_operations_async.py
new file mode 100644
index 000000000000..304102973036
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_documentation_operations_async.py
@@ -0,0 +1,101 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementDocumentationOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.documentation.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.documentation.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ documentation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.documentation.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ documentation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.documentation.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ documentation_id="str",
+ parameters={"content": "str", "id": "str", "name": "str", "title": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.documentation.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ documentation_id="str",
+ if_match="str",
+ parameters={"content": "str", "title": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.documentation.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ documentation_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_email_template_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_email_template_operations.py
new file mode 100644
index 000000000000..14b5e6e8d540
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_email_template_operations.py
@@ -0,0 +1,112 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementEmailTemplateOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.email_template.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.email_template.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ template_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.email_template.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ template_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.email_template.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ template_name="str",
+ parameters={
+ "body": "str",
+ "description": "str",
+ "parameters": [{"description": "str", "name": "str", "title": "str"}],
+ "subject": "str",
+ "title": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.email_template.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ template_name="str",
+ if_match="str",
+ parameters={
+ "body": "str",
+ "description": "str",
+ "parameters": [{"description": "str", "name": "str", "title": "str"}],
+ "subject": "str",
+ "title": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.email_template.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ template_name="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_email_template_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_email_template_operations_async.py
new file mode 100644
index 000000000000..0c2f3ca6e54f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_email_template_operations_async.py
@@ -0,0 +1,113 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementEmailTemplateOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.email_template.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.email_template.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ template_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.email_template.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ template_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.email_template.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ template_name="str",
+ parameters={
+ "body": "str",
+ "description": "str",
+ "parameters": [{"description": "str", "name": "str", "title": "str"}],
+ "subject": "str",
+ "title": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.email_template.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ template_name="str",
+ if_match="str",
+ parameters={
+ "body": "str",
+ "description": "str",
+ "parameters": [{"description": "str", "name": "str", "title": "str"}],
+ "subject": "str",
+ "title": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.email_template.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ template_name="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_api_operations.py
new file mode 100644
index 000000000000..de23d0b170cc
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_api_operations.py
@@ -0,0 +1,74 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGatewayApiOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.gateway_api.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.gateway_api.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.gateway_api.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.gateway_api.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_api_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_api_operations_async.py
new file mode 100644
index 000000000000..cd5a231b0a1e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_api_operations_async.py
@@ -0,0 +1,75 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGatewayApiOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.gateway_api.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.gateway_api.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.gateway_api.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.gateway_api.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_certificate_authority_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_certificate_authority_operations.py
new file mode 100644
index 000000000000..f3fbde10f643
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_certificate_authority_operations.py
@@ -0,0 +1,90 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGatewayCertificateAuthorityOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.gateway_certificate_authority.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.gateway_certificate_authority.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.gateway_certificate_authority.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.gateway_certificate_authority.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ certificate_id="str",
+ parameters={"id": "str", "isTrusted": bool, "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.gateway_certificate_authority.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ certificate_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_certificate_authority_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_certificate_authority_operations_async.py
new file mode 100644
index 000000000000..2d5860b8baad
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_certificate_authority_operations_async.py
@@ -0,0 +1,91 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGatewayCertificateAuthorityOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.gateway_certificate_authority.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.gateway_certificate_authority.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.gateway_certificate_authority.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.gateway_certificate_authority.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ certificate_id="str",
+ parameters={"id": "str", "isTrusted": bool, "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.gateway_certificate_authority.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ certificate_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_hostname_configuration_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_hostname_configuration_operations.py
new file mode 100644
index 000000000000..ce7ca6438451
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_hostname_configuration_operations.py
@@ -0,0 +1,100 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGatewayHostnameConfigurationOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.gateway_hostname_configuration.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.gateway_hostname_configuration.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ hc_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.gateway_hostname_configuration.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ hc_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.gateway_hostname_configuration.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ hc_id="str",
+ parameters={
+ "certificateId": "str",
+ "hostname": "str",
+ "http2Enabled": bool,
+ "id": "str",
+ "name": "str",
+ "negotiateClientCertificate": bool,
+ "tls10Enabled": bool,
+ "tls11Enabled": bool,
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.gateway_hostname_configuration.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ hc_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_hostname_configuration_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_hostname_configuration_operations_async.py
new file mode 100644
index 000000000000..6c344a57544a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_hostname_configuration_operations_async.py
@@ -0,0 +1,101 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGatewayHostnameConfigurationOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.gateway_hostname_configuration.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.gateway_hostname_configuration.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ hc_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.gateway_hostname_configuration.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ hc_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.gateway_hostname_configuration.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ hc_id="str",
+ parameters={
+ "certificateId": "str",
+ "hostname": "str",
+ "http2Enabled": bool,
+ "id": "str",
+ "name": "str",
+ "negotiateClientCertificate": bool,
+ "tls10Enabled": bool,
+ "tls11Enabled": bool,
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.gateway_hostname_configuration.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ hc_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_operations.py
new file mode 100644
index 000000000000..24cadb272398
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_operations.py
@@ -0,0 +1,194 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGatewayOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.gateway.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.gateway.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.gateway.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.gateway.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ parameters={
+ "description": "str",
+ "id": "str",
+ "locationData": {"name": "str", "city": "str", "countryOrRegion": "str", "district": "str"},
+ "name": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.gateway.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ if_match="str",
+ parameters={
+ "description": "str",
+ "id": "str",
+ "locationData": {"name": "str", "city": "str", "countryOrRegion": "str", "district": "str"},
+ "name": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.gateway.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_keys(self, resource_group):
+ response = self.client.gateway.list_keys(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_regenerate_key(self, resource_group):
+ response = self.client.gateway.regenerate_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ parameters={"keyType": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_generate_token(self, resource_group):
+ response = self.client.gateway.generate_token(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ parameters={"expiry": "2020-02-20 00:00:00", "keyType": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_invalidate_debug_credentials(self, resource_group):
+ response = self.client.gateway.invalidate_debug_credentials(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_debug_credentials(self, resource_group):
+ response = self.client.gateway.list_debug_credentials(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ parameters={"apiId": "str", "purposes": ["str"], "credentialsExpireAfter": "1 day, 0:00:00"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_trace(self, resource_group):
+ response = self.client.gateway.list_trace(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ parameters={"traceId": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_operations_async.py
new file mode 100644
index 000000000000..be0d2d4656f6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_gateway_operations_async.py
@@ -0,0 +1,195 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGatewayOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.gateway.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.gateway.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.gateway.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.gateway.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ parameters={
+ "description": "str",
+ "id": "str",
+ "locationData": {"name": "str", "city": "str", "countryOrRegion": "str", "district": "str"},
+ "name": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.gateway.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ if_match="str",
+ parameters={
+ "description": "str",
+ "id": "str",
+ "locationData": {"name": "str", "city": "str", "countryOrRegion": "str", "district": "str"},
+ "name": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.gateway.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_keys(self, resource_group):
+ response = await self.client.gateway.list_keys(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_regenerate_key(self, resource_group):
+ response = await self.client.gateway.regenerate_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ parameters={"keyType": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_generate_token(self, resource_group):
+ response = await self.client.gateway.generate_token(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ parameters={"expiry": "2020-02-20 00:00:00", "keyType": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_invalidate_debug_credentials(self, resource_group):
+ response = await self.client.gateway.invalidate_debug_credentials(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_debug_credentials(self, resource_group):
+ response = await self.client.gateway.list_debug_credentials(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ parameters={"apiId": "str", "purposes": ["str"], "credentialsExpireAfter": "1 day, 0:00:00"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_trace(self, resource_group):
+ response = await self.client.gateway.list_trace(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ gateway_id="str",
+ parameters={"traceId": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_global_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_global_schema_operations.py
new file mode 100644
index 000000000000..69a72ce1a8f7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_global_schema_operations.py
@@ -0,0 +1,94 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGlobalSchemaOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.global_schema.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.global_schema.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.global_schema.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.global_schema.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ schema_id="str",
+ parameters={
+ "description": "str",
+ "document": {},
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "schemaType": "str",
+ "type": "str",
+ "value": {},
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.global_schema.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ schema_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_global_schema_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_global_schema_operations_async.py
new file mode 100644
index 000000000000..a7173857460e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_global_schema_operations_async.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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGlobalSchemaOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.global_schema.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.global_schema.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.global_schema.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.global_schema.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ schema_id="str",
+ parameters={
+ "description": "str",
+ "document": {},
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "schemaType": "str",
+ "type": "str",
+ "value": {},
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.global_schema.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ schema_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_graph_ql_api_resolver_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_graph_ql_api_resolver_operations.py
new file mode 100644
index 000000000000..5b0855ed5080
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_graph_ql_api_resolver_operations.py
@@ -0,0 +1,113 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGraphQLApiResolverOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_api(self, resource_group):
+ response = self.client.graph_ql_api_resolver.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.graph_ql_api_resolver.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.graph_ql_api_resolver.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.graph_ql_api_resolver.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "name": "str",
+ "path": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.graph_ql_api_resolver.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ if_match="str",
+ parameters={"description": "str", "displayName": "str", "path": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.graph_ql_api_resolver.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_graph_ql_api_resolver_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_graph_ql_api_resolver_operations_async.py
new file mode 100644
index 000000000000..bb2579c966b5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_graph_ql_api_resolver_operations_async.py
@@ -0,0 +1,114 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGraphQLApiResolverOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_api(self, resource_group):
+ response = self.client.graph_ql_api_resolver.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.graph_ql_api_resolver.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.graph_ql_api_resolver.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.graph_ql_api_resolver.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "name": "str",
+ "path": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.graph_ql_api_resolver.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ if_match="str",
+ parameters={"description": "str", "displayName": "str", "path": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.graph_ql_api_resolver.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_graph_ql_api_resolver_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_graph_ql_api_resolver_policy_operations.py
new file mode 100644
index 000000000000..1333075c4b74
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_graph_ql_api_resolver_policy_operations.py
@@ -0,0 +1,95 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGraphQLApiResolverPolicyOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_resolver(self, resource_group):
+ response = self.client.graph_ql_api_resolver_policy.list_by_resolver(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.graph_ql_api_resolver_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.graph_ql_api_resolver_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.graph_ql_api_resolver_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.graph_ql_api_resolver_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_graph_ql_api_resolver_policy_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_graph_ql_api_resolver_policy_operations_async.py
new file mode 100644
index 000000000000..b690b8a8d600
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_graph_ql_api_resolver_policy_operations_async.py
@@ -0,0 +1,96 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGraphQLApiResolverPolicyOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_resolver(self, resource_group):
+ response = self.client.graph_ql_api_resolver_policy.list_by_resolver(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.graph_ql_api_resolver_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.graph_ql_api_resolver_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.graph_ql_api_resolver_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.graph_ql_api_resolver_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ resolver_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_group_operations.py
new file mode 100644
index 000000000000..d78183958e4d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_group_operations.py
@@ -0,0 +1,100 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGroupOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.group.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.group.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.group.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.group.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ parameters={"description": "str", "displayName": "str", "externalId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.group.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ if_match="str",
+ parameters={"description": "str", "displayName": "str", "externalId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.group.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_group_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_group_operations_async.py
new file mode 100644
index 000000000000..1bc24b9f8152
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_group_operations_async.py
@@ -0,0 +1,101 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGroupOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.group.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.group.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.group.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.group.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ parameters={"description": "str", "displayName": "str", "externalId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.group.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ if_match="str",
+ parameters={"description": "str", "displayName": "str", "externalId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.group.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_group_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_group_user_operations.py
new file mode 100644
index 000000000000..552bd04a868d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_group_user_operations.py
@@ -0,0 +1,74 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGroupUserOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.group_user.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_check_entity_exists(self, resource_group):
+ response = self.client.group_user.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create(self, resource_group):
+ response = self.client.group_user.create(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.group_user.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_group_user_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_group_user_operations_async.py
new file mode 100644
index 000000000000..058cf72b8a74
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_group_user_operations_async.py
@@ -0,0 +1,75 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementGroupUserOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.group_user.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_check_entity_exists(self, resource_group):
+ response = await self.client.group_user.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create(self, resource_group):
+ response = await self.client.group_user.create(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.group_user.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ group_id="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_identity_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_identity_provider_operations.py
new file mode 100644
index 000000000000..30ac20e54f12
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_identity_provider_operations.py
@@ -0,0 +1,141 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementIdentityProviderOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.identity_provider.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.identity_provider.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ identity_provider_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.identity_provider.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ identity_provider_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.identity_provider.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ identity_provider_name="str",
+ parameters={
+ "allowedTenants": ["str"],
+ "authority": "str",
+ "certificateId": "str",
+ "clientId": "str",
+ "clientLibrary": "str",
+ "clientSecret": "str",
+ "id": "str",
+ "name": "str",
+ "passwordResetPolicyName": "str",
+ "profileEditingPolicyName": "str",
+ "signinPolicyName": "str",
+ "signinTenant": "str",
+ "signupPolicyName": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.identity_provider.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ identity_provider_name="str",
+ if_match="str",
+ parameters={
+ "allowedTenants": ["str"],
+ "authority": "str",
+ "certificateId": "str",
+ "clientId": "str",
+ "clientLibrary": "str",
+ "clientSecret": "str",
+ "passwordResetPolicyName": "str",
+ "profileEditingPolicyName": "str",
+ "signinPolicyName": "str",
+ "signinTenant": "str",
+ "signupPolicyName": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.identity_provider.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ identity_provider_name="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_secrets(self, resource_group):
+ response = self.client.identity_provider.list_secrets(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ identity_provider_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_identity_provider_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_identity_provider_operations_async.py
new file mode 100644
index 000000000000..7304ff9d9e0f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_identity_provider_operations_async.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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementIdentityProviderOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.identity_provider.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.identity_provider.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ identity_provider_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.identity_provider.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ identity_provider_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.identity_provider.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ identity_provider_name="str",
+ parameters={
+ "allowedTenants": ["str"],
+ "authority": "str",
+ "certificateId": "str",
+ "clientId": "str",
+ "clientLibrary": "str",
+ "clientSecret": "str",
+ "id": "str",
+ "name": "str",
+ "passwordResetPolicyName": "str",
+ "profileEditingPolicyName": "str",
+ "signinPolicyName": "str",
+ "signinTenant": "str",
+ "signupPolicyName": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.identity_provider.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ identity_provider_name="str",
+ if_match="str",
+ parameters={
+ "allowedTenants": ["str"],
+ "authority": "str",
+ "certificateId": "str",
+ "clientId": "str",
+ "clientLibrary": "str",
+ "clientSecret": "str",
+ "passwordResetPolicyName": "str",
+ "profileEditingPolicyName": "str",
+ "signinPolicyName": "str",
+ "signinTenant": "str",
+ "signupPolicyName": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.identity_provider.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ identity_provider_name="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_secrets(self, resource_group):
+ response = await self.client.identity_provider.list_secrets(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ identity_provider_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_issue_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_issue_operations.py
new file mode 100644
index 000000000000..dcc1ff43829a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_issue_operations.py
@@ -0,0 +1,44 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementIssueOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.issue.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.issue.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ issue_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_issue_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_issue_operations_async.py
new file mode 100644
index 000000000000..fbdb5874d898
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_issue_operations_async.py
@@ -0,0 +1,45 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementIssueOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.issue.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.issue.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ issue_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_logger_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_logger_operations.py
new file mode 100644
index 000000000000..22bb276a35fc
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_logger_operations.py
@@ -0,0 +1,109 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementLoggerOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.logger.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.logger.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ logger_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.logger.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ logger_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.logger.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ logger_id="str",
+ parameters={
+ "credentials": {"str": "str"},
+ "description": "str",
+ "id": "str",
+ "isBuffered": bool,
+ "loggerType": "str",
+ "name": "str",
+ "resourceId": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.logger.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ logger_id="str",
+ if_match="str",
+ parameters={"credentials": {"str": "str"}, "description": "str", "isBuffered": bool, "loggerType": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.logger.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ logger_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_logger_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_logger_operations_async.py
new file mode 100644
index 000000000000..eb28078c7ae9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_logger_operations_async.py
@@ -0,0 +1,110 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementLoggerOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.logger.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.logger.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ logger_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.logger.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ logger_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.logger.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ logger_id="str",
+ parameters={
+ "credentials": {"str": "str"},
+ "description": "str",
+ "id": "str",
+ "isBuffered": bool,
+ "loggerType": "str",
+ "name": "str",
+ "resourceId": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.logger.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ logger_id="str",
+ if_match="str",
+ parameters={"credentials": {"str": "str"}, "description": "str", "isBuffered": bool, "loggerType": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.logger.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ logger_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_named_value_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_named_value_operations.py
new file mode 100644
index 000000000000..2d07b2aaad55
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_named_value_operations.py
@@ -0,0 +1,141 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementNamedValueOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.named_value.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.named_value.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.named_value.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.named_value.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ named_value_id="str",
+ parameters={
+ "displayName": "str",
+ "id": "str",
+ "keyVault": {"identityClientId": "str", "secretIdentifier": "str"},
+ "name": "str",
+ "secret": bool,
+ "tags": ["str"],
+ "type": "str",
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_update(self, resource_group):
+ response = self.client.named_value.begin_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ named_value_id="str",
+ if_match="str",
+ parameters={
+ "displayName": "str",
+ "keyVault": {"identityClientId": "str", "secretIdentifier": "str"},
+ "secret": bool,
+ "tags": ["str"],
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.named_value.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ named_value_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_value(self, resource_group):
+ response = self.client.named_value.list_value(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_refresh_secret(self, resource_group):
+ response = self.client.named_value.begin_refresh_secret(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_named_value_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_named_value_operations_async.py
new file mode 100644
index 000000000000..5bc5b6f1a66c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_named_value_operations_async.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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementNamedValueOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.named_value.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.named_value.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.named_value.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.named_value.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ named_value_id="str",
+ parameters={
+ "displayName": "str",
+ "id": "str",
+ "keyVault": {"identityClientId": "str", "secretIdentifier": "str"},
+ "name": "str",
+ "secret": bool,
+ "tags": ["str"],
+ "type": "str",
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_update(self, resource_group):
+ response = await (
+ await self.client.named_value.begin_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ named_value_id="str",
+ if_match="str",
+ parameters={
+ "displayName": "str",
+ "keyVault": {"identityClientId": "str", "secretIdentifier": "str"},
+ "secret": bool,
+ "tags": ["str"],
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.named_value.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ named_value_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_value(self, resource_group):
+ response = await self.client.named_value.list_value(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_refresh_secret(self, resource_group):
+ response = await (
+ await self.client.named_value.begin_refresh_secret(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_network_status_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_network_status_operations.py
new file mode 100644
index 000000000000..05631f4fe658
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_network_status_operations.py
@@ -0,0 +1,44 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementNetworkStatusOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.network_status.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_location(self, resource_group):
+ response = self.client.network_status.list_by_location(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ location_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_network_status_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_network_status_operations_async.py
new file mode 100644
index 000000000000..6daa3f517155
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_network_status_operations_async.py
@@ -0,0 +1,45 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementNetworkStatusOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = await self.client.network_status.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_location(self, resource_group):
+ response = await self.client.network_status.list_by_location(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ location_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_operations.py
new file mode 100644
index 000000000000..71ef8d8f86b1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_operations.py
@@ -0,0 +1,57 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementNotificationOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.notification.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.notification.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.notification.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_operations_async.py
new file mode 100644
index 000000000000..caa47d287d43
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_operations_async.py
@@ -0,0 +1,58 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementNotificationOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.notification.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.notification.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.notification.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_recipient_email_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_recipient_email_operations.py
new file mode 100644
index 000000000000..87e99c9f7966
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_recipient_email_operations.py
@@ -0,0 +1,74 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementNotificationRecipientEmailOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_notification(self, resource_group):
+ response = self.client.notification_recipient_email.list_by_notification(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_check_entity_exists(self, resource_group):
+ response = self.client.notification_recipient_email.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ email="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.notification_recipient_email.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ email="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.notification_recipient_email.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ email="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_recipient_email_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_recipient_email_operations_async.py
new file mode 100644
index 000000000000..17bf4575e0f2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_recipient_email_operations_async.py
@@ -0,0 +1,75 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementNotificationRecipientEmailOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_notification(self, resource_group):
+ response = await self.client.notification_recipient_email.list_by_notification(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_check_entity_exists(self, resource_group):
+ response = await self.client.notification_recipient_email.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ email="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.notification_recipient_email.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ email="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.notification_recipient_email.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ email="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_recipient_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_recipient_user_operations.py
new file mode 100644
index 000000000000..c58f8a8cc411
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_recipient_user_operations.py
@@ -0,0 +1,74 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementNotificationRecipientUserOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_notification(self, resource_group):
+ response = self.client.notification_recipient_user.list_by_notification(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_check_entity_exists(self, resource_group):
+ response = self.client.notification_recipient_user.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.notification_recipient_user.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.notification_recipient_user.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_recipient_user_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_recipient_user_operations_async.py
new file mode 100644
index 000000000000..0db7765e1d40
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_notification_recipient_user_operations_async.py
@@ -0,0 +1,75 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementNotificationRecipientUserOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_notification(self, resource_group):
+ response = await self.client.notification_recipient_user.list_by_notification(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_check_entity_exists(self, resource_group):
+ response = await self.client.notification_recipient_user.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.notification_recipient_user.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.notification_recipient_user.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ notification_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_open_id_connect_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_open_id_connect_provider_operations.py
new file mode 100644
index 000000000000..eff136df08ab
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_open_id_connect_provider_operations.py
@@ -0,0 +1,132 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementOpenIdConnectProviderOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.open_id_connect_provider.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.open_id_connect_provider.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ opid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.open_id_connect_provider.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ opid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.open_id_connect_provider.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ opid="str",
+ parameters={
+ "clientId": "str",
+ "clientSecret": "str",
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "metadataEndpoint": "str",
+ "name": "str",
+ "type": "str",
+ "useInApiDocumentation": bool,
+ "useInTestConsole": bool,
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.open_id_connect_provider.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ opid="str",
+ if_match="str",
+ parameters={
+ "clientId": "str",
+ "clientSecret": "str",
+ "description": "str",
+ "displayName": "str",
+ "metadataEndpoint": "str",
+ "useInApiDocumentation": bool,
+ "useInTestConsole": bool,
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.open_id_connect_provider.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ opid="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_secrets(self, resource_group):
+ response = self.client.open_id_connect_provider.list_secrets(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ opid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_open_id_connect_provider_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_open_id_connect_provider_operations_async.py
new file mode 100644
index 000000000000..d18b3136f9f6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_open_id_connect_provider_operations_async.py
@@ -0,0 +1,133 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementOpenIdConnectProviderOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.open_id_connect_provider.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.open_id_connect_provider.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ opid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.open_id_connect_provider.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ opid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.open_id_connect_provider.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ opid="str",
+ parameters={
+ "clientId": "str",
+ "clientSecret": "str",
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "metadataEndpoint": "str",
+ "name": "str",
+ "type": "str",
+ "useInApiDocumentation": bool,
+ "useInTestConsole": bool,
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.open_id_connect_provider.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ opid="str",
+ if_match="str",
+ parameters={
+ "clientId": "str",
+ "clientSecret": "str",
+ "description": "str",
+ "displayName": "str",
+ "metadataEndpoint": "str",
+ "useInApiDocumentation": bool,
+ "useInTestConsole": bool,
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.open_id_connect_provider.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ opid="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_secrets(self, resource_group):
+ response = await self.client.open_id_connect_provider.list_secrets(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ opid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operation_operations.py
new file mode 100644
index 000000000000..23a3885c53da
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operation_operations.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementOperationOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_tags(self, resource_group):
+ response = self.client.operation.list_by_tags(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operation_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operation_operations_async.py
new file mode 100644
index 000000000000..1116bfc75d08
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operation_operations_async.py
@@ -0,0 +1,33 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementOperationOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_tags(self, resource_group):
+ response = self.client.operation.list_by_tags(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operation_status_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operation_status_operations.py
new file mode 100644
index 000000000000..19df49717443
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operation_status_operations.py
@@ -0,0 +1,31 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementOperationStatusOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.operation_status.get(
+ location="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operation_status_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operation_status_operations_async.py
new file mode 100644
index 000000000000..1d2c3d22a8b9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operation_status_operations_async.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementOperationStatusOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.operation_status.get(
+ location="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operations_results_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operations_results_operations.py
new file mode 100644
index 000000000000..b7955b1b091c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operations_results_operations.py
@@ -0,0 +1,31 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementOperationsResultsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.operations_results.get(
+ location="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operations_results_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operations_results_operations_async.py
new file mode 100644
index 000000000000..adf104a5221c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_operations_results_operations_async.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementOperationsResultsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.operations_results.get(
+ location="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_outbound_network_dependencies_endpoints_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_outbound_network_dependencies_endpoints_operations.py
new file mode 100644
index 000000000000..b573e0465301
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_outbound_network_dependencies_endpoints_operations.py
@@ -0,0 +1,31 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementOutboundNetworkDependenciesEndpointsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.outbound_network_dependencies_endpoints.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_outbound_network_dependencies_endpoints_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_outbound_network_dependencies_endpoints_operations_async.py
new file mode 100644
index 000000000000..7f37fd43cc25
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_outbound_network_dependencies_endpoints_operations_async.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementOutboundNetworkDependenciesEndpointsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = await self.client.outbound_network_dependencies_endpoints.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_description_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_description_operations.py
new file mode 100644
index 000000000000..529e05850a23
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_description_operations.py
@@ -0,0 +1,31 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPolicyDescriptionOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.policy_description.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_description_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_description_operations_async.py
new file mode 100644
index 000000000000..be5950ef7f4e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_description_operations_async.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPolicyDescriptionOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = await self.client.policy_description.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_fragment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_fragment_operations.py
new file mode 100644
index 000000000000..a47f755c7e2d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_fragment_operations.py
@@ -0,0 +1,106 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPolicyFragmentOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.policy_fragment.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.policy_fragment.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.policy_fragment.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.policy_fragment.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ id="str",
+ parameters={
+ "description": "str",
+ "format": "str",
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "type": "str",
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.policy_fragment.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_references(self, resource_group):
+ response = self.client.policy_fragment.list_references(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_fragment_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_fragment_operations_async.py
new file mode 100644
index 000000000000..20d9b042ee5e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_fragment_operations_async.py
@@ -0,0 +1,109 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPolicyFragmentOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.policy_fragment.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.policy_fragment.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.policy_fragment.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.policy_fragment.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ id="str",
+ parameters={
+ "description": "str",
+ "format": "str",
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "type": "str",
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.policy_fragment.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_references(self, resource_group):
+ response = await self.client.policy_fragment.list_references(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_operations.py
new file mode 100644
index 000000000000..bb18e4f3dd71
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_operations.py
@@ -0,0 +1,85 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPolicyOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.policy.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_operations_async.py
new file mode 100644
index 000000000000..bcbd37a6e45c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_operations_async.py
@@ -0,0 +1,86 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPolicyOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.policy.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_restriction_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_restriction_operations.py
new file mode 100644
index 000000000000..5723ace21e7b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_restriction_operations.py
@@ -0,0 +1,99 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPolicyRestrictionOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.policy_restriction.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.policy_restriction.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_restriction_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.policy_restriction.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_restriction_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.policy_restriction.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_restriction_id="str",
+ parameters={"id": "str", "name": "str", "requireBase": "false", "scope": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.policy_restriction.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_restriction_id="str",
+ if_match="str",
+ parameters={"requireBase": "false", "scope": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.policy_restriction.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_restriction_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_restriction_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_restriction_operations_async.py
new file mode 100644
index 000000000000..41e8ef46469f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_restriction_operations_async.py
@@ -0,0 +1,100 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPolicyRestrictionOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.policy_restriction.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.policy_restriction.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_restriction_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.policy_restriction.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_restriction_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.policy_restriction.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_restriction_id="str",
+ parameters={"id": "str", "name": "str", "requireBase": "false", "scope": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.policy_restriction.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_restriction_id="str",
+ if_match="str",
+ parameters={"requireBase": "false", "scope": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.policy_restriction.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ policy_restriction_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_restriction_validations_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_restriction_validations_operations.py
new file mode 100644
index 000000000000..b12c125e90c7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_restriction_validations_operations.py
@@ -0,0 +1,31 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPolicyRestrictionValidationsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_by_service(self, resource_group):
+ response = self.client.policy_restriction_validations.begin_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_restriction_validations_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_restriction_validations_operations_async.py
new file mode 100644
index 000000000000..44d42424d180
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_policy_restriction_validations_operations_async.py
@@ -0,0 +1,34 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPolicyRestrictionValidationsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_by_service(self, resource_group):
+ response = await (
+ await self.client.policy_restriction_validations.begin_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_config_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_config_operations.py
new file mode 100644
index 000000000000..e306d4354bdc
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_config_operations.py
@@ -0,0 +1,117 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPortalConfigOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.portal_config.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.portal_config.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_config_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.portal_config.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_config_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.portal_config.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_config_id="str",
+ if_match="str",
+ parameters={
+ "cors": {"allowedOrigins": ["str"]},
+ "csp": {"allowedSources": ["str"], "mode": "disabled", "reportUri": ["str"]},
+ "delegation": {
+ "delegateRegistration": False,
+ "delegateSubscription": False,
+ "delegationUrl": "str",
+ "validationKey": "str",
+ },
+ "enableBasicAuth": True,
+ "id": "str",
+ "name": "str",
+ "signin": {"require": False},
+ "signup": {"termsOfService": {"requireConsent": False, "text": "str"}},
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.portal_config.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_config_id="str",
+ if_match="str",
+ parameters={
+ "cors": {"allowedOrigins": ["str"]},
+ "csp": {"allowedSources": ["str"], "mode": "disabled", "reportUri": ["str"]},
+ "delegation": {
+ "delegateRegistration": False,
+ "delegateSubscription": False,
+ "delegationUrl": "str",
+ "validationKey": "str",
+ },
+ "enableBasicAuth": True,
+ "id": "str",
+ "name": "str",
+ "signin": {"require": False},
+ "signup": {"termsOfService": {"requireConsent": False, "text": "str"}},
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_config_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_config_operations_async.py
new file mode 100644
index 000000000000..0fb6d245e96b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_config_operations_async.py
@@ -0,0 +1,118 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPortalConfigOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.portal_config.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.portal_config.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_config_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.portal_config.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_config_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.portal_config.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_config_id="str",
+ if_match="str",
+ parameters={
+ "cors": {"allowedOrigins": ["str"]},
+ "csp": {"allowedSources": ["str"], "mode": "disabled", "reportUri": ["str"]},
+ "delegation": {
+ "delegateRegistration": False,
+ "delegateSubscription": False,
+ "delegationUrl": "str",
+ "validationKey": "str",
+ },
+ "enableBasicAuth": True,
+ "id": "str",
+ "name": "str",
+ "signin": {"require": False},
+ "signup": {"termsOfService": {"requireConsent": False, "text": "str"}},
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.portal_config.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_config_id="str",
+ if_match="str",
+ parameters={
+ "cors": {"allowedOrigins": ["str"]},
+ "csp": {"allowedSources": ["str"], "mode": "disabled", "reportUri": ["str"]},
+ "delegation": {
+ "delegateRegistration": False,
+ "delegateSubscription": False,
+ "delegationUrl": "str",
+ "validationKey": "str",
+ },
+ "enableBasicAuth": True,
+ "id": "str",
+ "name": "str",
+ "signin": {"require": False},
+ "signup": {"termsOfService": {"requireConsent": False, "text": "str"}},
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_revision_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_revision_operations.py
new file mode 100644
index 000000000000..e9817c52beb2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_revision_operations.py
@@ -0,0 +1,108 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPortalRevisionOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.portal_revision.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.portal_revision.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_revision_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.portal_revision.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_revision_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.portal_revision.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_revision_id="str",
+ parameters={
+ "createdDateTime": "2020-02-20 00:00:00",
+ "description": "str",
+ "id": "str",
+ "isCurrent": bool,
+ "name": "str",
+ "provisioningState": "str",
+ "status": "str",
+ "statusDetails": "str",
+ "type": "str",
+ "updatedDateTime": "2020-02-20 00:00:00",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_update(self, resource_group):
+ response = self.client.portal_revision.begin_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_revision_id="str",
+ if_match="str",
+ parameters={
+ "createdDateTime": "2020-02-20 00:00:00",
+ "description": "str",
+ "id": "str",
+ "isCurrent": bool,
+ "name": "str",
+ "provisioningState": "str",
+ "status": "str",
+ "statusDetails": "str",
+ "type": "str",
+ "updatedDateTime": "2020-02-20 00:00:00",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_revision_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_revision_operations_async.py
new file mode 100644
index 000000000000..cde8deef7f8b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_revision_operations_async.py
@@ -0,0 +1,113 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPortalRevisionOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.portal_revision.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.portal_revision.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_revision_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.portal_revision.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_revision_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.portal_revision.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_revision_id="str",
+ parameters={
+ "createdDateTime": "2020-02-20 00:00:00",
+ "description": "str",
+ "id": "str",
+ "isCurrent": bool,
+ "name": "str",
+ "provisioningState": "str",
+ "status": "str",
+ "statusDetails": "str",
+ "type": "str",
+ "updatedDateTime": "2020-02-20 00:00:00",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_update(self, resource_group):
+ response = await (
+ await self.client.portal_revision.begin_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ portal_revision_id="str",
+ if_match="str",
+ parameters={
+ "createdDateTime": "2020-02-20 00:00:00",
+ "description": "str",
+ "id": "str",
+ "isCurrent": bool,
+ "name": "str",
+ "provisioningState": "str",
+ "status": "str",
+ "statusDetails": "str",
+ "type": "str",
+ "updatedDateTime": "2020-02-20 00:00:00",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_settings_operations.py
new file mode 100644
index 000000000000..2442aa1f55d9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_settings_operations.py
@@ -0,0 +1,31 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPortalSettingsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.portal_settings.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_settings_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_settings_operations_async.py
new file mode 100644
index 000000000000..90eb92b1c98b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_portal_settings_operations_async.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPortalSettingsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = await self.client.portal_settings.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_private_endpoint_connection_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_private_endpoint_connection_operations.py
new file mode 100644
index 000000000000..74d2babe01df
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_private_endpoint_connection_operations.py
@@ -0,0 +1,105 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPrivateEndpointConnectionOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.private_endpoint_connection.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_by_name(self, resource_group):
+ response = self.client.private_endpoint_connection.get_by_name(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ private_endpoint_connection_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.private_endpoint_connection.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ private_endpoint_connection_name="str",
+ private_endpoint_connection_request={
+ "id": "str",
+ "properties": {
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ }
+ },
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_delete(self, resource_group):
+ response = self.client.private_endpoint_connection.begin_delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ private_endpoint_connection_name="str",
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_private_link_resources(self, resource_group):
+ response = self.client.private_endpoint_connection.list_private_link_resources(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_private_link_resource(self, resource_group):
+ response = self.client.private_endpoint_connection.get_private_link_resource(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ private_link_sub_resource_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_private_endpoint_connection_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_private_endpoint_connection_operations_async.py
new file mode 100644
index 000000000000..94adef609418
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_private_endpoint_connection_operations_async.py
@@ -0,0 +1,110 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementPrivateEndpointConnectionOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.private_endpoint_connection.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_by_name(self, resource_group):
+ response = await self.client.private_endpoint_connection.get_by_name(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ private_endpoint_connection_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.private_endpoint_connection.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ private_endpoint_connection_name="str",
+ private_endpoint_connection_request={
+ "id": "str",
+ "properties": {
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ }
+ },
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_delete(self, resource_group):
+ response = await (
+ await self.client.private_endpoint_connection.begin_delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ private_endpoint_connection_name="str",
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_private_link_resources(self, resource_group):
+ response = await self.client.private_endpoint_connection.list_private_link_resources(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_private_link_resource(self, resource_group):
+ response = await self.client.private_endpoint_connection.get_private_link_resource(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ private_link_sub_resource_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_api_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_api_link_operations.py
new file mode 100644
index 000000000000..c926d1d0d0b4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_api_link_operations.py
@@ -0,0 +1,75 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductApiLinkOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.product_api_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.product_api_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.product_api_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_link_id="str",
+ parameters={"apiId": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.product_api_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_api_link_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_api_link_operations_async.py
new file mode 100644
index 000000000000..df7f82baad92
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_api_link_operations_async.py
@@ -0,0 +1,76 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductApiLinkOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.product_api_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.product_api_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.product_api_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_link_id="str",
+ parameters={"apiId": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.product_api_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_api_operations.py
new file mode 100644
index 000000000000..34ad90e83bca
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_api_operations.py
@@ -0,0 +1,74 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductApiOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.product_api.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_check_entity_exists(self, resource_group):
+ response = self.client.product_api.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.product_api.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.product_api.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_api_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_api_operations_async.py
new file mode 100644
index 000000000000..555f5643ec1c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_api_operations_async.py
@@ -0,0 +1,75 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductApiOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.product_api.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_check_entity_exists(self, resource_group):
+ response = await self.client.product_api.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.product_api.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.product_api.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_group_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_group_link_operations.py
new file mode 100644
index 000000000000..d0a676157eaa
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_group_link_operations.py
@@ -0,0 +1,75 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductGroupLinkOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.product_group_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.product_group_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ group_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.product_group_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ group_link_id="str",
+ parameters={"groupId": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.product_group_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ group_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_group_link_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_group_link_operations_async.py
new file mode 100644
index 000000000000..d5886092092d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_group_link_operations_async.py
@@ -0,0 +1,76 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductGroupLinkOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.product_group_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.product_group_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ group_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.product_group_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ group_link_id="str",
+ parameters={"groupId": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.product_group_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ group_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_group_operations.py
new file mode 100644
index 000000000000..841409163443
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_group_operations.py
@@ -0,0 +1,74 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductGroupOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.product_group.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_check_entity_exists(self, resource_group):
+ response = self.client.product_group.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.product_group.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.product_group.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_group_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_group_operations_async.py
new file mode 100644
index 000000000000..45c2b330ee7b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_group_operations_async.py
@@ -0,0 +1,75 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductGroupOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.product_group.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_check_entity_exists(self, resource_group):
+ response = await self.client.product_group.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.product_group.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.product_group.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_operations.py
new file mode 100644
index 000000000000..24daa949c2a1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_operations.py
@@ -0,0 +1,131 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.product.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.product.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.product.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.product.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ parameters={
+ "approvalRequired": bool,
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "name": "str",
+ "state": "str",
+ "subscriptionRequired": bool,
+ "subscriptionsLimit": 0,
+ "terms": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.product.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ if_match="str",
+ parameters={
+ "approvalRequired": bool,
+ "description": "str",
+ "displayName": "str",
+ "state": "str",
+ "subscriptionRequired": bool,
+ "subscriptionsLimit": 0,
+ "terms": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.product.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_tags(self, resource_group):
+ response = self.client.product.list_by_tags(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_operations_async.py
new file mode 100644
index 000000000000..f7c1b124ffcd
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_operations_async.py
@@ -0,0 +1,132 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.product.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.product.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.product.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.product.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ parameters={
+ "approvalRequired": bool,
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "name": "str",
+ "state": "str",
+ "subscriptionRequired": bool,
+ "subscriptionsLimit": 0,
+ "terms": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.product.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ if_match="str",
+ parameters={
+ "approvalRequired": bool,
+ "description": "str",
+ "displayName": "str",
+ "state": "str",
+ "subscriptionRequired": bool,
+ "subscriptionsLimit": 0,
+ "terms": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.product.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_tags(self, resource_group):
+ response = self.client.product.list_by_tags(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_policy_operations.py
new file mode 100644
index 000000000000..d3fdcc14109e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_policy_operations.py
@@ -0,0 +1,90 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductPolicyOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.product_policy.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.product_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.product_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.product_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.product_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_policy_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_policy_operations_async.py
new file mode 100644
index 000000000000..820a713dfdac
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_policy_operations_async.py
@@ -0,0 +1,91 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductPolicyOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.product_policy.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.product_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.product_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.product_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.product_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_subscriptions_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_subscriptions_operations.py
new file mode 100644
index 000000000000..7f6e0763691b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_subscriptions_operations.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductSubscriptionsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.product_subscriptions.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_subscriptions_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_subscriptions_operations_async.py
new file mode 100644
index 000000000000..c9cb66bff1a5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_subscriptions_operations_async.py
@@ -0,0 +1,33 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.product_subscriptions.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_wiki_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_wiki_operations.py
new file mode 100644
index 000000000000..fa3115fad46a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_wiki_operations.py
@@ -0,0 +1,88 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductWikiOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.product_wiki.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.product_wiki.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.product_wiki.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ parameters={"documents": [{"documentationId": "str"}], "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.product_wiki.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ if_match="str",
+ parameters={"documents": [{"documentationId": "str"}]},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.product_wiki.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_wiki_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_wiki_operations_async.py
new file mode 100644
index 000000000000..7fdf3509a7a8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_wiki_operations_async.py
@@ -0,0 +1,89 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductWikiOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.product_wiki.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.product_wiki.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.product_wiki.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ parameters={"documents": [{"documentationId": "str"}], "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.product_wiki.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ if_match="str",
+ parameters={"documents": [{"documentationId": "str"}]},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.product_wiki.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_wikis_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_wikis_operations.py
new file mode 100644
index 000000000000..af8225b471c4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_wikis_operations.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductWikisOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.product_wikis.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_wikis_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_wikis_operations_async.py
new file mode 100644
index 000000000000..af5e77866e8a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_product_wikis_operations_async.py
@@ -0,0 +1,33 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementProductWikisOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.product_wikis.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_quota_by_counter_keys_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_quota_by_counter_keys_operations.py
new file mode 100644
index 000000000000..673ca66430e9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_quota_by_counter_keys_operations.py
@@ -0,0 +1,46 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementQuotaByCounterKeysOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.quota_by_counter_keys.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ quota_counter_key="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.quota_by_counter_keys.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ quota_counter_key="str",
+ parameters={"callsCount": 0, "kbTransferred": 0.0},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_quota_by_counter_keys_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_quota_by_counter_keys_operations_async.py
new file mode 100644
index 000000000000..e8bdfdeda883
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_quota_by_counter_keys_operations_async.py
@@ -0,0 +1,47 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementQuotaByCounterKeysOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = await self.client.quota_by_counter_keys.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ quota_counter_key="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.quota_by_counter_keys.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ quota_counter_key="str",
+ parameters={"callsCount": 0, "kbTransferred": 0.0},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_quota_by_period_keys_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_quota_by_period_keys_operations.py
new file mode 100644
index 000000000000..06062e3b6e25
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_quota_by_period_keys_operations.py
@@ -0,0 +1,48 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementQuotaByPeriodKeysOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.quota_by_period_keys.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ quota_counter_key="str",
+ quota_period_key="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.quota_by_period_keys.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ quota_counter_key="str",
+ quota_period_key="str",
+ parameters={"callsCount": 0, "kbTransferred": 0.0},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_quota_by_period_keys_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_quota_by_period_keys_operations_async.py
new file mode 100644
index 000000000000..33832b90879e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_quota_by_period_keys_operations_async.py
@@ -0,0 +1,49 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementQuotaByPeriodKeysOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.quota_by_period_keys.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ quota_counter_key="str",
+ quota_period_key="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.quota_by_period_keys.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ quota_counter_key="str",
+ quota_period_key="str",
+ parameters={"callsCount": 0, "kbTransferred": 0.0},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_region_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_region_operations.py
new file mode 100644
index 000000000000..5cf3f8a1effb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_region_operations.py
@@ -0,0 +1,31 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementRegionOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.region.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_region_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_region_operations_async.py
new file mode 100644
index 000000000000..a3df9d9f65d2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_region_operations_async.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementRegionOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.region.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_reports_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_reports_operations.py
new file mode 100644
index 000000000000..e0cf61f6d38f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_reports_operations.py
@@ -0,0 +1,124 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementReportsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_api(self, resource_group):
+ response = self.client.reports.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_user(self, resource_group):
+ response = self.client.reports.list_by_user(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_operation(self, resource_group):
+ response = self.client.reports.list_by_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.reports.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_geo(self, resource_group):
+ response = self.client.reports.list_by_geo(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_subscription(self, resource_group):
+ response = self.client.reports.list_by_subscription(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_time(self, resource_group):
+ response = self.client.reports.list_by_time(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ interval="1 day, 0:00:00",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_request(self, resource_group):
+ response = self.client.reports.list_by_request(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_reports_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_reports_operations_async.py
new file mode 100644
index 000000000000..5de544710c5c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_reports_operations_async.py
@@ -0,0 +1,125 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementReportsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_api(self, resource_group):
+ response = self.client.reports.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_user(self, resource_group):
+ response = self.client.reports.list_by_user(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_operation(self, resource_group):
+ response = self.client.reports.list_by_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.reports.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_geo(self, resource_group):
+ response = self.client.reports.list_by_geo(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_subscription(self, resource_group):
+ response = self.client.reports.list_by_subscription(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_time(self, resource_group):
+ response = self.client.reports.list_by_time(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ interval="1 day, 0:00:00",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_request(self, resource_group):
+ response = self.client.reports.list_by_request(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ filter="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_sign_in_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_sign_in_settings_operations.py
new file mode 100644
index 000000000000..7744fc1965d8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_sign_in_settings_operations.py
@@ -0,0 +1,70 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementSignInSettingsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.sign_in_settings.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.sign_in_settings.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.sign_in_settings.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ if_match="str",
+ parameters={"enabled": bool, "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.sign_in_settings.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ parameters={"enabled": bool, "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_sign_in_settings_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_sign_in_settings_operations_async.py
new file mode 100644
index 000000000000..03b231e6e5d4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_sign_in_settings_operations_async.py
@@ -0,0 +1,71 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementSignInSettingsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.sign_in_settings.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.sign_in_settings.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.sign_in_settings.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ if_match="str",
+ parameters={"enabled": bool, "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.sign_in_settings.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ parameters={"enabled": bool, "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_sign_up_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_sign_up_settings_operations.py
new file mode 100644
index 000000000000..d8fd08a57756
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_sign_up_settings_operations.py
@@ -0,0 +1,82 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementSignUpSettingsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.sign_up_settings.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.sign_up_settings.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.sign_up_settings.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ if_match="str",
+ parameters={
+ "enabled": bool,
+ "id": "str",
+ "name": "str",
+ "termsOfService": {"consentRequired": bool, "enabled": bool, "text": "str"},
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.sign_up_settings.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ parameters={
+ "enabled": bool,
+ "id": "str",
+ "name": "str",
+ "termsOfService": {"consentRequired": bool, "enabled": bool, "text": "str"},
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_sign_up_settings_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_sign_up_settings_operations_async.py
new file mode 100644
index 000000000000..aa0ca4191a0c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_sign_up_settings_operations_async.py
@@ -0,0 +1,83 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementSignUpSettingsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.sign_up_settings.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.sign_up_settings.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.sign_up_settings.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ if_match="str",
+ parameters={
+ "enabled": bool,
+ "id": "str",
+ "name": "str",
+ "termsOfService": {"consentRequired": bool, "enabled": bool, "text": "str"},
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.sign_up_settings.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ parameters={
+ "enabled": bool,
+ "id": "str",
+ "name": "str",
+ "termsOfService": {"consentRequired": bool, "enabled": bool, "text": "str"},
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_subscription_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_subscription_operations.py
new file mode 100644
index 000000000000..c0ee644f4a79
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_subscription_operations.py
@@ -0,0 +1,157 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementSubscriptionOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.subscription.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.subscription.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.subscription.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.subscription.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ parameters={
+ "allowTracing": bool,
+ "displayName": "str",
+ "ownerId": "str",
+ "primaryKey": "str",
+ "scope": "str",
+ "secondaryKey": "str",
+ "state": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.subscription.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ if_match="str",
+ parameters={
+ "allowTracing": bool,
+ "displayName": "str",
+ "expirationDate": "2020-02-20 00:00:00",
+ "ownerId": "str",
+ "primaryKey": "str",
+ "scope": "str",
+ "secondaryKey": "str",
+ "state": "str",
+ "stateComment": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.subscription.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_regenerate_primary_key(self, resource_group):
+ response = self.client.subscription.regenerate_primary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_regenerate_secondary_key(self, resource_group):
+ response = self.client.subscription.regenerate_secondary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_secrets(self, resource_group):
+ response = self.client.subscription.list_secrets(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_subscription_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_subscription_operations_async.py
new file mode 100644
index 000000000000..0c7548ee4f0e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_subscription_operations_async.py
@@ -0,0 +1,158 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementSubscriptionOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.subscription.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.subscription.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.subscription.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.subscription.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ parameters={
+ "allowTracing": bool,
+ "displayName": "str",
+ "ownerId": "str",
+ "primaryKey": "str",
+ "scope": "str",
+ "secondaryKey": "str",
+ "state": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.subscription.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ if_match="str",
+ parameters={
+ "allowTracing": bool,
+ "displayName": "str",
+ "expirationDate": "2020-02-20 00:00:00",
+ "ownerId": "str",
+ "primaryKey": "str",
+ "scope": "str",
+ "secondaryKey": "str",
+ "state": "str",
+ "stateComment": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.subscription.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_regenerate_primary_key(self, resource_group):
+ response = await self.client.subscription.regenerate_primary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_regenerate_secondary_key(self, resource_group):
+ response = await self.client.subscription.regenerate_secondary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_secrets(self, resource_group):
+ response = await self.client.subscription.list_secrets(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_api_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_api_link_operations.py
new file mode 100644
index 000000000000..9295f6b0d2d9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_api_link_operations.py
@@ -0,0 +1,75 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTagApiLinkOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.tag_api_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.tag_api_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.tag_api_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_link_id="str",
+ parameters={"apiId": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.tag_api_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_api_link_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_api_link_operations_async.py
new file mode 100644
index 000000000000..0b40f64056cb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_api_link_operations_async.py
@@ -0,0 +1,76 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTagApiLinkOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.tag_api_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.tag_api_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.tag_api_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_link_id="str",
+ parameters={"apiId": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.tag_api_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_operation_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_operation_link_operations.py
new file mode 100644
index 000000000000..fbc7bd680c96
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_operation_link_operations.py
@@ -0,0 +1,75 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTagOperationLinkOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.tag_operation_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.tag_operation_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ operation_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.tag_operation_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ operation_link_id="str",
+ parameters={"id": "str", "name": "str", "operationId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.tag_operation_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ operation_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_operation_link_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_operation_link_operations_async.py
new file mode 100644
index 000000000000..a5c1b464cc2a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_operation_link_operations_async.py
@@ -0,0 +1,76 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTagOperationLinkOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.tag_operation_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.tag_operation_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ operation_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.tag_operation_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ operation_link_id="str",
+ parameters={"id": "str", "name": "str", "operationId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.tag_operation_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ operation_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_operations.py
new file mode 100644
index 000000000000..bf9ea0bfffac
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_operations.py
@@ -0,0 +1,312 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTagOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_operation(self, resource_group):
+ response = self.client.tag.list_by_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_state_by_operation(self, resource_group):
+ response = self.client.tag.get_entity_state_by_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_by_operation(self, resource_group):
+ response = self.client.tag.get_by_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_assign_to_operation(self, resource_group):
+ response = self.client.tag.assign_to_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_detach_from_operation(self, resource_group):
+ response = self.client.tag.detach_from_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_api(self, resource_group):
+ response = self.client.tag.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_state_by_api(self, resource_group):
+ response = self.client.tag.get_entity_state_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_by_api(self, resource_group):
+ response = self.client.tag.get_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_assign_to_api(self, resource_group):
+ response = self.client.tag.assign_to_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_detach_from_api(self, resource_group):
+ response = self.client.tag.detach_from_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.tag.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_state_by_product(self, resource_group):
+ response = self.client.tag.get_entity_state_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_by_product(self, resource_group):
+ response = self.client.tag.get_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_assign_to_product(self, resource_group):
+ response = self.client.tag.assign_to_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_detach_from_product(self, resource_group):
+ response = self.client.tag.detach_from_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.tag.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_state(self, resource_group):
+ response = self.client.tag.get_entity_state(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.tag.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.tag.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ parameters={"displayName": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.tag.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ if_match="str",
+ parameters={"displayName": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.tag.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_operations_async.py
new file mode 100644
index 000000000000..e1f165ecd0a0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_operations_async.py
@@ -0,0 +1,313 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTagOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_operation(self, resource_group):
+ response = self.client.tag.list_by_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_state_by_operation(self, resource_group):
+ response = await self.client.tag.get_entity_state_by_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_by_operation(self, resource_group):
+ response = await self.client.tag.get_by_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_assign_to_operation(self, resource_group):
+ response = await self.client.tag.assign_to_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_detach_from_operation(self, resource_group):
+ response = await self.client.tag.detach_from_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ operation_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_api(self, resource_group):
+ response = self.client.tag.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_state_by_api(self, resource_group):
+ response = await self.client.tag.get_entity_state_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_by_api(self, resource_group):
+ response = await self.client.tag.get_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_assign_to_api(self, resource_group):
+ response = await self.client.tag.assign_to_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_detach_from_api(self, resource_group):
+ response = await self.client.tag.detach_from_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.tag.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_state_by_product(self, resource_group):
+ response = await self.client.tag.get_entity_state_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_by_product(self, resource_group):
+ response = await self.client.tag.get_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_assign_to_product(self, resource_group):
+ response = await self.client.tag.assign_to_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_detach_from_product(self, resource_group):
+ response = await self.client.tag.detach_from_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ product_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.tag.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_state(self, resource_group):
+ response = await self.client.tag.get_entity_state(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.tag.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.tag.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ parameters={"displayName": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.tag.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ if_match="str",
+ parameters={"displayName": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.tag.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_product_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_product_link_operations.py
new file mode 100644
index 000000000000..354511228fd1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_product_link_operations.py
@@ -0,0 +1,75 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTagProductLinkOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.tag_product_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.tag_product_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ product_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.tag_product_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ product_link_id="str",
+ parameters={"id": "str", "name": "str", "productId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.tag_product_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ product_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_product_link_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_product_link_operations_async.py
new file mode 100644
index 000000000000..9b98762bcf0c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_product_link_operations_async.py
@@ -0,0 +1,76 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTagProductLinkOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.tag_product_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.tag_product_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ product_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.tag_product_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ product_link_id="str",
+ parameters={"id": "str", "name": "str", "productId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.tag_product_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ tag_id="str",
+ product_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_resource_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_resource_operations.py
new file mode 100644
index 000000000000..6529cb3b85e2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_resource_operations.py
@@ -0,0 +1,31 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTagResourceOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.tag_resource.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_resource_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_resource_operations_async.py
new file mode 100644
index 000000000000..d27302a712a5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tag_resource_operations_async.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTagResourceOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.tag_resource.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_access_git_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_access_git_operations.py
new file mode 100644
index 000000000000..d9d22d535a8c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_access_git_operations.py
@@ -0,0 +1,45 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTenantAccessGitOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_regenerate_primary_key(self, resource_group):
+ response = self.client.tenant_access_git.regenerate_primary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_regenerate_secondary_key(self, resource_group):
+ response = self.client.tenant_access_git.regenerate_secondary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_access_git_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_access_git_operations_async.py
new file mode 100644
index 000000000000..54b31a435275
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_access_git_operations_async.py
@@ -0,0 +1,46 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTenantAccessGitOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_regenerate_primary_key(self, resource_group):
+ response = await self.client.tenant_access_git.regenerate_primary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_regenerate_secondary_key(self, resource_group):
+ response = await self.client.tenant_access_git.regenerate_secondary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_access_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_access_operations.py
new file mode 100644
index 000000000000..7a21b5ab8478
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_access_operations.py
@@ -0,0 +1,126 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTenantAccessOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.tenant_access.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.tenant_access.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.tenant_access.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create(self, resource_group):
+ response = self.client.tenant_access.create(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ if_match="str",
+ parameters={"enabled": bool, "primaryKey": "str", "principalId": "str", "secondaryKey": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.tenant_access.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ if_match="str",
+ parameters={"enabled": bool},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_regenerate_primary_key(self, resource_group):
+ response = self.client.tenant_access.regenerate_primary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_regenerate_secondary_key(self, resource_group):
+ response = self.client.tenant_access.regenerate_secondary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_secrets(self, resource_group):
+ response = self.client.tenant_access.list_secrets(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_access_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_access_operations_async.py
new file mode 100644
index 000000000000..0e1c2a3e23b3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_access_operations_async.py
@@ -0,0 +1,127 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTenantAccessOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.tenant_access.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.tenant_access.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.tenant_access.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create(self, resource_group):
+ response = await self.client.tenant_access.create(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ if_match="str",
+ parameters={"enabled": bool, "primaryKey": "str", "principalId": "str", "secondaryKey": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.tenant_access.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ if_match="str",
+ parameters={"enabled": bool},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_regenerate_primary_key(self, resource_group):
+ response = await self.client.tenant_access.regenerate_primary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_regenerate_secondary_key(self, resource_group):
+ response = await self.client.tenant_access.regenerate_secondary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_secrets(self, resource_group):
+ response = await self.client.tenant_access.list_secrets(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ access_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_configuration_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_configuration_operations.py
new file mode 100644
index 000000000000..7526fa4e85e1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_configuration_operations.py
@@ -0,0 +1,74 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTenantConfigurationOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_deploy(self, resource_group):
+ response = self.client.tenant_configuration.begin_deploy(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ configuration_name="str",
+ parameters={"branch": "str", "force": bool},
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_save(self, resource_group):
+ response = self.client.tenant_configuration.begin_save(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ configuration_name="str",
+ parameters={"branch": "str", "force": bool},
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_validate(self, resource_group):
+ response = self.client.tenant_configuration.begin_validate(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ configuration_name="str",
+ parameters={"branch": "str", "force": bool},
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_sync_state(self, resource_group):
+ response = self.client.tenant_configuration.get_sync_state(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ configuration_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_configuration_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_configuration_operations_async.py
new file mode 100644
index 000000000000..2e5377b6950d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_configuration_operations_async.py
@@ -0,0 +1,81 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTenantConfigurationOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_deploy(self, resource_group):
+ response = await (
+ await self.client.tenant_configuration.begin_deploy(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ configuration_name="str",
+ parameters={"branch": "str", "force": bool},
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_save(self, resource_group):
+ response = await (
+ await self.client.tenant_configuration.begin_save(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ configuration_name="str",
+ parameters={"branch": "str", "force": bool},
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_validate(self, resource_group):
+ response = await (
+ await self.client.tenant_configuration.begin_validate(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ configuration_name="str",
+ parameters={"branch": "str", "force": bool},
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_sync_state(self, resource_group):
+ response = await self.client.tenant_configuration.get_sync_state(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ configuration_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_settings_operations.py
new file mode 100644
index 000000000000..b3418e8d47be
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_settings_operations.py
@@ -0,0 +1,44 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTenantSettingsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.tenant_settings.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.tenant_settings.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ settings_type="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_settings_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_settings_operations_async.py
new file mode 100644
index 000000000000..9a14eeede61d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_tenant_settings_operations_async.py
@@ -0,0 +1,45 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementTenantSettingsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.tenant_settings.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.tenant_settings.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ settings_type="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_confirmation_password_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_confirmation_password_operations.py
new file mode 100644
index 000000000000..36cfb7becbf7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_confirmation_password_operations.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementUserConfirmationPasswordOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_send(self, resource_group):
+ response = self.client.user_confirmation_password.send(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_confirmation_password_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_confirmation_password_operations_async.py
new file mode 100644
index 000000000000..86bae2ecf509
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_confirmation_password_operations_async.py
@@ -0,0 +1,33 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementUserConfirmationPasswordOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_send(self, resource_group):
+ response = await self.client.user_confirmation_password.send(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_group_operations.py
new file mode 100644
index 000000000000..9bd9ffa75d5b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_group_operations.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementUserGroupOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.user_group.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_group_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_group_operations_async.py
new file mode 100644
index 000000000000..55c6f0f02f47
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_group_operations_async.py
@@ -0,0 +1,33 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementUserGroupOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.user_group.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_identities_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_identities_operations.py
new file mode 100644
index 000000000000..ee6efbbbaceb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_identities_operations.py
@@ -0,0 +1,32 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementUserIdentitiesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.user_identities.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_identities_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_identities_operations_async.py
new file mode 100644
index 000000000000..9c2bb0e15e53
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_identities_operations_async.py
@@ -0,0 +1,33 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementUserIdentitiesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.user_identities.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_operations.py
new file mode 100644
index 000000000000..39826a15b2b4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_operations.py
@@ -0,0 +1,145 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementUserOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.user.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.user.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.user.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.user.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ parameters={
+ "appType": "str",
+ "confirmation": "str",
+ "email": "str",
+ "firstName": "str",
+ "identities": [{"id": "str", "provider": "str"}],
+ "lastName": "str",
+ "note": "str",
+ "password": "str",
+ "state": "active",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.user.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ if_match="str",
+ parameters={
+ "email": "str",
+ "firstName": "str",
+ "identities": [{"id": "str", "provider": "str"}],
+ "lastName": "str",
+ "note": "str",
+ "password": "str",
+ "state": "active",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_delete(self, resource_group):
+ response = self.client.user.begin_delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_generate_sso_url(self, resource_group):
+ response = self.client.user.generate_sso_url(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_shared_access_token(self, resource_group):
+ response = self.client.user.get_shared_access_token(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ parameters={"expiry": "2020-02-20 00:00:00", "keyType": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_operations_async.py
new file mode 100644
index 000000000000..6b213ada346c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_operations_async.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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementUserOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.user.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.user.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.user.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.user.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ parameters={
+ "appType": "str",
+ "confirmation": "str",
+ "email": "str",
+ "firstName": "str",
+ "identities": [{"id": "str", "provider": "str"}],
+ "lastName": "str",
+ "note": "str",
+ "password": "str",
+ "state": "active",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.user.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ if_match="str",
+ parameters={
+ "email": "str",
+ "firstName": "str",
+ "identities": [{"id": "str", "provider": "str"}],
+ "lastName": "str",
+ "note": "str",
+ "password": "str",
+ "state": "active",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_delete(self, resource_group):
+ response = await (
+ await self.client.user.begin_delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_generate_sso_url(self, resource_group):
+ response = await self.client.user.generate_sso_url(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_shared_access_token(self, resource_group):
+ response = await self.client.user.get_shared_access_token(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ parameters={"expiry": "2020-02-20 00:00:00", "keyType": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_subscription_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_subscription_operations.py
new file mode 100644
index 000000000000..7ab84d179e23
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_subscription_operations.py
@@ -0,0 +1,46 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementUserSubscriptionOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.user_subscription.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.user_subscription.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_subscription_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_subscription_operations_async.py
new file mode 100644
index 000000000000..518fda8f6d97
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_user_subscription_operations_async.py
@@ -0,0 +1,47 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementUserSubscriptionOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.user_subscription.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.user_subscription.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ user_id="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_diagnostic_operations.py
new file mode 100644
index 000000000000..b402e1db4344
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_diagnostic_operations.py
@@ -0,0 +1,213 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiDiagnosticOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_workspace(self, resource_group):
+ response = self.client.workspace_api_diagnostic.list_by_workspace(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_api_diagnostic.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_api_diagnostic.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_api_diagnostic.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ diagnostic_id="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "largeLanguageModel": {
+ "logs": "str",
+ "requests": {"maxSizeInBytes": 32768, "messages": "str"},
+ "responses": {"maxSizeInBytes": 32768, "messages": "str"},
+ },
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.workspace_api_diagnostic.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ diagnostic_id="str",
+ if_match="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_api_diagnostic.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ diagnostic_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_diagnostic_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_diagnostic_operations_async.py
new file mode 100644
index 000000000000..c14537c42dae
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_diagnostic_operations_async.py
@@ -0,0 +1,214 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiDiagnosticOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_workspace(self, resource_group):
+ response = self.client.workspace_api_diagnostic.list_by_workspace(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_api_diagnostic.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_api_diagnostic.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_api_diagnostic.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ diagnostic_id="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "largeLanguageModel": {
+ "logs": "str",
+ "requests": {"maxSizeInBytes": 32768, "messages": "str"},
+ "responses": {"maxSizeInBytes": 32768, "messages": "str"},
+ },
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.workspace_api_diagnostic.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ diagnostic_id="str",
+ if_match="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_api_diagnostic.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ diagnostic_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_export_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_export_operations.py
new file mode 100644
index 000000000000..8888763fb16a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_export_operations.py
@@ -0,0 +1,35 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiExportOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_api_export.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ format="str",
+ export="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_export_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_export_operations_async.py
new file mode 100644
index 000000000000..5faf7900231c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_export_operations_async.py
@@ -0,0 +1,36 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiExportOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_api_export.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ format="str",
+ export="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operation_operations.py
new file mode 100644
index 000000000000..0ea25dcdd2ca
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operation_operations.py
@@ -0,0 +1,385 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiOperationOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_api(self, resource_group):
+ response = self.client.workspace_api_operation.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_api_operation.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_api_operation.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_api_operation.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "method": "str",
+ "name": "str",
+ "policies": "str",
+ "request": {
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "queryParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ },
+ "responses": [
+ {
+ "statusCode": 0,
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ }
+ ],
+ "templateParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "type": "str",
+ "urlTemplate": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.workspace_api_operation.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ if_match="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "method": "str",
+ "policies": "str",
+ "request": {
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "queryParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ },
+ "responses": [
+ {
+ "statusCode": 0,
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ }
+ ],
+ "templateParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "urlTemplate": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_api_operation.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operation_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operation_operations_async.py
new file mode 100644
index 000000000000..46b7e5d04bca
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operation_operations_async.py
@@ -0,0 +1,386 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiOperationOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_api(self, resource_group):
+ response = self.client.workspace_api_operation.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_api_operation.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_api_operation.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_api_operation.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "method": "str",
+ "name": "str",
+ "policies": "str",
+ "request": {
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "queryParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ },
+ "responses": [
+ {
+ "statusCode": 0,
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ }
+ ],
+ "templateParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "type": "str",
+ "urlTemplate": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.workspace_api_operation.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ if_match="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "method": "str",
+ "policies": "str",
+ "request": {
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "queryParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ },
+ "responses": [
+ {
+ "statusCode": 0,
+ "description": "str",
+ "headers": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "representations": [
+ {
+ "contentType": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "formParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {
+ "description": "str",
+ "externalValue": "str",
+ "summary": "str",
+ "value": {},
+ }
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "schemaId": "str",
+ "typeName": "str",
+ }
+ ],
+ }
+ ],
+ "templateParameters": [
+ {
+ "name": "str",
+ "type": "str",
+ "defaultValue": "str",
+ "description": "str",
+ "examples": {
+ "str": {"description": "str", "externalValue": "str", "summary": "str", "value": {}}
+ },
+ "required": bool,
+ "schemaId": "str",
+ "typeName": "str",
+ "values": ["str"],
+ }
+ ],
+ "urlTemplate": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_api_operation.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operation_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operation_policy_operations.py
new file mode 100644
index 000000000000..96175448e0c2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operation_policy_operations.py
@@ -0,0 +1,100 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiOperationPolicyOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_operation(self, resource_group):
+ response = self.client.workspace_api_operation_policy.list_by_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_api_operation_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_api_operation_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_api_operation_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_api_operation_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operation_policy_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operation_policy_operations_async.py
new file mode 100644
index 000000000000..4107de0213cb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operation_policy_operations_async.py
@@ -0,0 +1,101 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiOperationPolicyOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_operation(self, resource_group):
+ response = self.client.workspace_api_operation_policy.list_by_operation(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_api_operation_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_api_operation_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_api_operation_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_api_operation_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ operation_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operations.py
new file mode 100644
index 000000000000..823047447af2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operations.py
@@ -0,0 +1,171 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.workspace_api.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_api.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_api.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.workspace_api.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ parameters={
+ "apiRevision": "str",
+ "apiRevisionDescription": "str",
+ "apiType": "str",
+ "apiVersion": "str",
+ "apiVersionDescription": "str",
+ "apiVersionSet": {
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "versionHeaderName": "str",
+ "versionQueryName": "str",
+ "versioningScheme": "str",
+ },
+ "apiVersionSetId": "str",
+ "authenticationSettings": {
+ "oAuth2": {"authorizationServerId": "str", "scope": "str"},
+ "oAuth2AuthenticationSettings": [{"authorizationServerId": "str", "scope": "str"}],
+ "openid": {"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"},
+ "openidAuthenticationSettings": [{"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"}],
+ },
+ "contact": {"email": "str", "name": "str", "url": "str"},
+ "description": "str",
+ "displayName": "str",
+ "format": "str",
+ "isCurrent": bool,
+ "isOnline": bool,
+ "license": {"name": "str", "url": "str"},
+ "path": "str",
+ "protocols": ["str"],
+ "provisioningState": "str",
+ "serviceUrl": "str",
+ "sourceApiId": "str",
+ "subscriptionKeyParameterNames": {"header": "str", "query": "str"},
+ "subscriptionRequired": bool,
+ "termsOfServiceUrl": "str",
+ "translateRequiredQueryParameters": "str",
+ "type": "str",
+ "value": "str",
+ "wsdlSelector": {"wsdlEndpointName": "str", "wsdlServiceName": "str"},
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.workspace_api.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ if_match="str",
+ parameters={
+ "apiRevision": "str",
+ "apiRevisionDescription": "str",
+ "apiVersion": "str",
+ "apiVersionDescription": "str",
+ "apiVersionSetId": "str",
+ "authenticationSettings": {
+ "oAuth2": {"authorizationServerId": "str", "scope": "str"},
+ "oAuth2AuthenticationSettings": [{"authorizationServerId": "str", "scope": "str"}],
+ "openid": {"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"},
+ "openidAuthenticationSettings": [{"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"}],
+ },
+ "contact": {"email": "str", "name": "str", "url": "str"},
+ "description": "str",
+ "displayName": "str",
+ "isCurrent": bool,
+ "isOnline": bool,
+ "license": {"name": "str", "url": "str"},
+ "path": "str",
+ "protocols": ["str"],
+ "serviceUrl": "str",
+ "subscriptionKeyParameterNames": {"header": "str", "query": "str"},
+ "subscriptionRequired": bool,
+ "termsOfServiceUrl": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_api.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operations_async.py
new file mode 100644
index 000000000000..f99cec802d67
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_operations_async.py
@@ -0,0 +1,176 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.workspace_api.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_api.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_api.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.workspace_api.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ parameters={
+ "apiRevision": "str",
+ "apiRevisionDescription": "str",
+ "apiType": "str",
+ "apiVersion": "str",
+ "apiVersionDescription": "str",
+ "apiVersionSet": {
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "versionHeaderName": "str",
+ "versionQueryName": "str",
+ "versioningScheme": "str",
+ },
+ "apiVersionSetId": "str",
+ "authenticationSettings": {
+ "oAuth2": {"authorizationServerId": "str", "scope": "str"},
+ "oAuth2AuthenticationSettings": [{"authorizationServerId": "str", "scope": "str"}],
+ "openid": {"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"},
+ "openidAuthenticationSettings": [
+ {"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"}
+ ],
+ },
+ "contact": {"email": "str", "name": "str", "url": "str"},
+ "description": "str",
+ "displayName": "str",
+ "format": "str",
+ "isCurrent": bool,
+ "isOnline": bool,
+ "license": {"name": "str", "url": "str"},
+ "path": "str",
+ "protocols": ["str"],
+ "provisioningState": "str",
+ "serviceUrl": "str",
+ "sourceApiId": "str",
+ "subscriptionKeyParameterNames": {"header": "str", "query": "str"},
+ "subscriptionRequired": bool,
+ "termsOfServiceUrl": "str",
+ "translateRequiredQueryParameters": "str",
+ "type": "str",
+ "value": "str",
+ "wsdlSelector": {"wsdlEndpointName": "str", "wsdlServiceName": "str"},
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.workspace_api.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ if_match="str",
+ parameters={
+ "apiRevision": "str",
+ "apiRevisionDescription": "str",
+ "apiVersion": "str",
+ "apiVersionDescription": "str",
+ "apiVersionSetId": "str",
+ "authenticationSettings": {
+ "oAuth2": {"authorizationServerId": "str", "scope": "str"},
+ "oAuth2AuthenticationSettings": [{"authorizationServerId": "str", "scope": "str"}],
+ "openid": {"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"},
+ "openidAuthenticationSettings": [{"bearerTokenSendingMethods": ["str"], "openidProviderId": "str"}],
+ },
+ "contact": {"email": "str", "name": "str", "url": "str"},
+ "description": "str",
+ "displayName": "str",
+ "isCurrent": bool,
+ "isOnline": bool,
+ "license": {"name": "str", "url": "str"},
+ "path": "str",
+ "protocols": ["str"],
+ "serviceUrl": "str",
+ "subscriptionKeyParameterNames": {"header": "str", "query": "str"},
+ "subscriptionRequired": bool,
+ "termsOfServiceUrl": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_api.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_policy_operations.py
new file mode 100644
index 000000000000..e3bb56315e4e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_policy_operations.py
@@ -0,0 +1,95 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiPolicyOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_api(self, resource_group):
+ response = self.client.workspace_api_policy.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_api_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_api_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_api_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_api_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_policy_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_policy_operations_async.py
new file mode 100644
index 000000000000..2f7b426d78d1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_policy_operations_async.py
@@ -0,0 +1,96 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiPolicyOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_api(self, resource_group):
+ response = self.client.workspace_api_policy.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_api_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_api_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_api_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_api_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_release_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_release_operations.py
new file mode 100644
index 000000000000..73fb4c10a870
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_release_operations.py
@@ -0,0 +1,128 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiReleaseOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.workspace_api_release.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_api_release.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ release_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_api_release.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ release_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_api_release.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ release_id="str",
+ parameters={
+ "apiId": "str",
+ "createdDateTime": "2020-02-20 00:00:00",
+ "id": "str",
+ "name": "str",
+ "notes": "str",
+ "type": "str",
+ "updatedDateTime": "2020-02-20 00:00:00",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.workspace_api_release.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ release_id="str",
+ if_match="str",
+ parameters={
+ "apiId": "str",
+ "createdDateTime": "2020-02-20 00:00:00",
+ "id": "str",
+ "name": "str",
+ "notes": "str",
+ "type": "str",
+ "updatedDateTime": "2020-02-20 00:00:00",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_api_release.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ release_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_release_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_release_operations_async.py
new file mode 100644
index 000000000000..8fdcb752a8f1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_release_operations_async.py
@@ -0,0 +1,129 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiReleaseOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.workspace_api_release.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_api_release.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ release_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_api_release.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ release_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_api_release.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ release_id="str",
+ parameters={
+ "apiId": "str",
+ "createdDateTime": "2020-02-20 00:00:00",
+ "id": "str",
+ "name": "str",
+ "notes": "str",
+ "type": "str",
+ "updatedDateTime": "2020-02-20 00:00:00",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.workspace_api_release.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ release_id="str",
+ if_match="str",
+ parameters={
+ "apiId": "str",
+ "createdDateTime": "2020-02-20 00:00:00",
+ "id": "str",
+ "name": "str",
+ "notes": "str",
+ "type": "str",
+ "updatedDateTime": "2020-02-20 00:00:00",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_api_release.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ release_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_revision_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_revision_operations.py
new file mode 100644
index 000000000000..63b2780eecd2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_revision_operations.py
@@ -0,0 +1,33 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiRevisionOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.workspace_api_revision.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_revision_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_revision_operations_async.py
new file mode 100644
index 000000000000..67e845136252
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_revision_operations_async.py
@@ -0,0 +1,34 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiRevisionOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.workspace_api_revision.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_schema_operations.py
new file mode 100644
index 000000000000..4a4366b82b6b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_schema_operations.py
@@ -0,0 +1,104 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiSchemaOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_api(self, resource_group):
+ response = self.client.workspace_api_schema.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_api_schema.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_api_schema.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.workspace_api_schema.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ schema_id="str",
+ parameters={
+ "components": {},
+ "contentType": "str",
+ "definitions": {},
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "type": "str",
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_api_schema.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ schema_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_schema_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_schema_operations_async.py
new file mode 100644
index 000000000000..eb272c8b6e28
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_schema_operations_async.py
@@ -0,0 +1,107 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiSchemaOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_api(self, resource_group):
+ response = self.client.workspace_api_schema.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_api_schema.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_api_schema.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.workspace_api_schema.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ schema_id="str",
+ parameters={
+ "components": {},
+ "contentType": "str",
+ "definitions": {},
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "type": "str",
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_api_schema.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_id="str",
+ schema_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_version_set_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_version_set_operations.py
new file mode 100644
index 000000000000..5b617340933d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_version_set_operations.py
@@ -0,0 +1,121 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiVersionSetOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.workspace_api_version_set.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_api_version_set.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ version_set_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_api_version_set.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ version_set_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_api_version_set.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ version_set_id="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "name": "str",
+ "type": "str",
+ "versionHeaderName": "str",
+ "versionQueryName": "str",
+ "versioningScheme": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.workspace_api_version_set.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ version_set_id="str",
+ if_match="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "versionHeaderName": "str",
+ "versionQueryName": "str",
+ "versioningScheme": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_api_version_set.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ version_set_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_version_set_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_version_set_operations_async.py
new file mode 100644
index 000000000000..f4f96b996957
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_api_version_set_operations_async.py
@@ -0,0 +1,122 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceApiVersionSetOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.workspace_api_version_set.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_api_version_set.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ version_set_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_api_version_set.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ version_set_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_api_version_set.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ version_set_id="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "name": "str",
+ "type": "str",
+ "versionHeaderName": "str",
+ "versionQueryName": "str",
+ "versioningScheme": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.workspace_api_version_set.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ version_set_id="str",
+ if_match="str",
+ parameters={
+ "description": "str",
+ "displayName": "str",
+ "versionHeaderName": "str",
+ "versionQueryName": "str",
+ "versioningScheme": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_api_version_set.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ version_set_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_backend_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_backend_operations.py
new file mode 100644
index 000000000000..4ab51c07b16f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_backend_operations.py
@@ -0,0 +1,194 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceBackendOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_workspace(self, resource_group):
+ response = self.client.workspace_backend.list_by_workspace(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_backend.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ backend_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_backend.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ backend_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_backend.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ backend_id="str",
+ parameters={
+ "circuitBreaker": {
+ "rules": [
+ {
+ "acceptRetryAfter": bool,
+ "failureCondition": {
+ "count": 0,
+ "errorReasons": ["str"],
+ "interval": "1 day, 0:00:00",
+ "percentage": 0,
+ "statusCodeRanges": [{"max": 0, "min": 0}],
+ },
+ "name": "str",
+ "tripDuration": "1 day, 0:00:00",
+ }
+ ]
+ },
+ "credentials": {
+ "authorization": {"parameter": "str", "scheme": "str"},
+ "certificate": ["str"],
+ "certificateIds": ["str"],
+ "header": {"str": ["str"]},
+ "query": {"str": ["str"]},
+ },
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "pool": {"services": [{"id": "str", "priority": 0, "weight": 0}]},
+ "properties": {
+ "serviceFabricCluster": {
+ "managementEndpoints": ["str"],
+ "clientCertificateId": "str",
+ "clientCertificatethumbprint": "str",
+ "maxPartitionResolutionRetries": 0,
+ "serverCertificateThumbprints": ["str"],
+ "serverX509Names": [{"issuerCertificateThumbprint": "str", "name": "str"}],
+ }
+ },
+ "protocol": "str",
+ "proxy": {"url": "str", "password": "str", "username": "str"},
+ "resourceId": "str",
+ "title": "str",
+ "tls": {"validateCertificateChain": True, "validateCertificateName": True},
+ "type": "str",
+ "url": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.workspace_backend.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ backend_id="str",
+ if_match="str",
+ parameters={
+ "circuitBreaker": {
+ "rules": [
+ {
+ "acceptRetryAfter": bool,
+ "failureCondition": {
+ "count": 0,
+ "errorReasons": ["str"],
+ "interval": "1 day, 0:00:00",
+ "percentage": 0,
+ "statusCodeRanges": [{"max": 0, "min": 0}],
+ },
+ "name": "str",
+ "tripDuration": "1 day, 0:00:00",
+ }
+ ]
+ },
+ "credentials": {
+ "authorization": {"parameter": "str", "scheme": "str"},
+ "certificate": ["str"],
+ "certificateIds": ["str"],
+ "header": {"str": ["str"]},
+ "query": {"str": ["str"]},
+ },
+ "description": "str",
+ "pool": {"services": [{"id": "str", "priority": 0, "weight": 0}]},
+ "properties": {
+ "serviceFabricCluster": {
+ "managementEndpoints": ["str"],
+ "clientCertificateId": "str",
+ "clientCertificatethumbprint": "str",
+ "maxPartitionResolutionRetries": 0,
+ "serverCertificateThumbprints": ["str"],
+ "serverX509Names": [{"issuerCertificateThumbprint": "str", "name": "str"}],
+ }
+ },
+ "protocol": "str",
+ "proxy": {"url": "str", "password": "str", "username": "str"},
+ "resourceId": "str",
+ "title": "str",
+ "tls": {"validateCertificateChain": True, "validateCertificateName": True},
+ "type": "str",
+ "url": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_backend.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ backend_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_backend_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_backend_operations_async.py
new file mode 100644
index 000000000000..6f80f043d77e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_backend_operations_async.py
@@ -0,0 +1,195 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceBackendOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_workspace(self, resource_group):
+ response = self.client.workspace_backend.list_by_workspace(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_backend.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ backend_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_backend.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ backend_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_backend.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ backend_id="str",
+ parameters={
+ "circuitBreaker": {
+ "rules": [
+ {
+ "acceptRetryAfter": bool,
+ "failureCondition": {
+ "count": 0,
+ "errorReasons": ["str"],
+ "interval": "1 day, 0:00:00",
+ "percentage": 0,
+ "statusCodeRanges": [{"max": 0, "min": 0}],
+ },
+ "name": "str",
+ "tripDuration": "1 day, 0:00:00",
+ }
+ ]
+ },
+ "credentials": {
+ "authorization": {"parameter": "str", "scheme": "str"},
+ "certificate": ["str"],
+ "certificateIds": ["str"],
+ "header": {"str": ["str"]},
+ "query": {"str": ["str"]},
+ },
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "pool": {"services": [{"id": "str", "priority": 0, "weight": 0}]},
+ "properties": {
+ "serviceFabricCluster": {
+ "managementEndpoints": ["str"],
+ "clientCertificateId": "str",
+ "clientCertificatethumbprint": "str",
+ "maxPartitionResolutionRetries": 0,
+ "serverCertificateThumbprints": ["str"],
+ "serverX509Names": [{"issuerCertificateThumbprint": "str", "name": "str"}],
+ }
+ },
+ "protocol": "str",
+ "proxy": {"url": "str", "password": "str", "username": "str"},
+ "resourceId": "str",
+ "title": "str",
+ "tls": {"validateCertificateChain": True, "validateCertificateName": True},
+ "type": "str",
+ "url": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.workspace_backend.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ backend_id="str",
+ if_match="str",
+ parameters={
+ "circuitBreaker": {
+ "rules": [
+ {
+ "acceptRetryAfter": bool,
+ "failureCondition": {
+ "count": 0,
+ "errorReasons": ["str"],
+ "interval": "1 day, 0:00:00",
+ "percentage": 0,
+ "statusCodeRanges": [{"max": 0, "min": 0}],
+ },
+ "name": "str",
+ "tripDuration": "1 day, 0:00:00",
+ }
+ ]
+ },
+ "credentials": {
+ "authorization": {"parameter": "str", "scheme": "str"},
+ "certificate": ["str"],
+ "certificateIds": ["str"],
+ "header": {"str": ["str"]},
+ "query": {"str": ["str"]},
+ },
+ "description": "str",
+ "pool": {"services": [{"id": "str", "priority": 0, "weight": 0}]},
+ "properties": {
+ "serviceFabricCluster": {
+ "managementEndpoints": ["str"],
+ "clientCertificateId": "str",
+ "clientCertificatethumbprint": "str",
+ "maxPartitionResolutionRetries": 0,
+ "serverCertificateThumbprints": ["str"],
+ "serverX509Names": [{"issuerCertificateThumbprint": "str", "name": "str"}],
+ }
+ },
+ "protocol": "str",
+ "proxy": {"url": "str", "password": "str", "username": "str"},
+ "resourceId": "str",
+ "title": "str",
+ "tls": {"validateCertificateChain": True, "validateCertificateName": True},
+ "type": "str",
+ "url": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_backend.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ backend_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_certificate_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_certificate_operations.py
new file mode 100644
index 000000000000..cd13a76fbb40
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_certificate_operations.py
@@ -0,0 +1,108 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceCertificateOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_workspace(self, resource_group):
+ response = self.client.workspace_certificate.list_by_workspace(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_certificate.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_certificate.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_certificate.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ certificate_id="str",
+ parameters={
+ "data": "str",
+ "keyVault": {"identityClientId": "str", "secretIdentifier": "str"},
+ "password": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_certificate.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ certificate_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_refresh_secret(self, resource_group):
+ response = self.client.workspace_certificate.refresh_secret(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_certificate_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_certificate_operations_async.py
new file mode 100644
index 000000000000..b9b333e8670b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_certificate_operations_async.py
@@ -0,0 +1,109 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceCertificateOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_workspace(self, resource_group):
+ response = self.client.workspace_certificate.list_by_workspace(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_certificate.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_certificate.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_certificate.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ certificate_id="str",
+ parameters={
+ "data": "str",
+ "keyVault": {"identityClientId": "str", "secretIdentifier": "str"},
+ "password": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_certificate.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ certificate_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_refresh_secret(self, resource_group):
+ response = await self.client.workspace_certificate.refresh_secret(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ certificate_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_diagnostic_operations.py
new file mode 100644
index 000000000000..665556c84c57
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_diagnostic_operations.py
@@ -0,0 +1,207 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceDiagnosticOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_workspace(self, resource_group):
+ response = self.client.workspace_diagnostic.list_by_workspace(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_diagnostic.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_diagnostic.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_diagnostic.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ diagnostic_id="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "largeLanguageModel": {
+ "logs": "str",
+ "requests": {"maxSizeInBytes": 32768, "messages": "str"},
+ "responses": {"maxSizeInBytes": 32768, "messages": "str"},
+ },
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.workspace_diagnostic.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ diagnostic_id="str",
+ if_match="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_diagnostic.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ diagnostic_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_diagnostic_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_diagnostic_operations_async.py
new file mode 100644
index 000000000000..0680607fd358
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_diagnostic_operations_async.py
@@ -0,0 +1,208 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceDiagnosticOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_workspace(self, resource_group):
+ response = self.client.workspace_diagnostic.list_by_workspace(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_diagnostic.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_diagnostic.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ diagnostic_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_diagnostic.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ diagnostic_id="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "largeLanguageModel": {
+ "logs": "str",
+ "requests": {"maxSizeInBytes": 32768, "messages": "str"},
+ "responses": {"maxSizeInBytes": 32768, "messages": "str"},
+ },
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.workspace_diagnostic.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ diagnostic_id="str",
+ if_match="str",
+ parameters={
+ "alwaysLog": "str",
+ "backend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "frontend": {
+ "request": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ "response": {
+ "body": {"bytes": 0},
+ "dataMasking": {
+ "headers": [{"mode": "str", "value": "str"}],
+ "queryParams": [{"mode": "str", "value": "str"}],
+ },
+ "headers": ["str"],
+ },
+ },
+ "httpCorrelationProtocol": "str",
+ "id": "str",
+ "logClientIp": bool,
+ "loggerId": "str",
+ "metrics": bool,
+ "name": "str",
+ "operationNameFormat": "str",
+ "sampling": {"percentage": 0.0, "samplingType": "str"},
+ "type": "str",
+ "verbosity": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_diagnostic.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ diagnostic_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_global_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_global_schema_operations.py
new file mode 100644
index 000000000000..e8417636e41f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_global_schema_operations.py
@@ -0,0 +1,99 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceGlobalSchemaOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.workspace_global_schema.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_global_schema.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_global_schema.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.workspace_global_schema.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ schema_id="str",
+ parameters={
+ "description": "str",
+ "document": {},
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "schemaType": "str",
+ "type": "str",
+ "value": {},
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_global_schema.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ schema_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_global_schema_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_global_schema_operations_async.py
new file mode 100644
index 000000000000..356add7a6f62
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_global_schema_operations_async.py
@@ -0,0 +1,102 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceGlobalSchemaOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.workspace_global_schema.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_global_schema.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_global_schema.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ schema_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.workspace_global_schema.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ schema_id="str",
+ parameters={
+ "description": "str",
+ "document": {},
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "schemaType": "str",
+ "type": "str",
+ "value": {},
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_global_schema.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ schema_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_group_operations.py
new file mode 100644
index 000000000000..e51d887c1f5f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_group_operations.py
@@ -0,0 +1,106 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceGroupOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.workspace_group.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_group.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_group.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_group.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ parameters={"description": "str", "displayName": "str", "externalId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.workspace_group.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ if_match="str",
+ parameters={"description": "str", "displayName": "str", "externalId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_group.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_group_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_group_operations_async.py
new file mode 100644
index 000000000000..543d4d11d473
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_group_operations_async.py
@@ -0,0 +1,107 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceGroupOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.workspace_group.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_group.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_group.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_group.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ parameters={"description": "str", "displayName": "str", "externalId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.workspace_group.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ if_match="str",
+ parameters={"description": "str", "displayName": "str", "externalId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_group.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_group_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_group_user_operations.py
new file mode 100644
index 000000000000..a7919b0eca02
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_group_user_operations.py
@@ -0,0 +1,78 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceGroupUserOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.workspace_group_user.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_check_entity_exists(self, resource_group):
+ response = self.client.workspace_group_user.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create(self, resource_group):
+ response = self.client.workspace_group_user.create(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_group_user.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_group_user_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_group_user_operations_async.py
new file mode 100644
index 000000000000..ee2e244a21f3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_group_user_operations_async.py
@@ -0,0 +1,79 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceGroupUserOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.workspace_group_user.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_check_entity_exists(self, resource_group):
+ response = await self.client.workspace_group_user.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create(self, resource_group):
+ response = await self.client.workspace_group_user.create(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_group_user.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ group_id="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_logger_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_logger_operations.py
new file mode 100644
index 000000000000..88fa8efa8fd7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_logger_operations.py
@@ -0,0 +1,115 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceLoggerOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_workspace(self, resource_group):
+ response = self.client.workspace_logger.list_by_workspace(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_logger.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ logger_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_logger.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ logger_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_logger.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ logger_id="str",
+ parameters={
+ "credentials": {"str": "str"},
+ "description": "str",
+ "id": "str",
+ "isBuffered": bool,
+ "loggerType": "str",
+ "name": "str",
+ "resourceId": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.workspace_logger.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ logger_id="str",
+ if_match="str",
+ parameters={"credentials": {"str": "str"}, "description": "str", "isBuffered": bool, "loggerType": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_logger.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ logger_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_logger_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_logger_operations_async.py
new file mode 100644
index 000000000000..0c769b8fe2eb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_logger_operations_async.py
@@ -0,0 +1,116 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceLoggerOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_workspace(self, resource_group):
+ response = self.client.workspace_logger.list_by_workspace(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_logger.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ logger_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_logger.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ logger_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_logger.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ logger_id="str",
+ parameters={
+ "credentials": {"str": "str"},
+ "description": "str",
+ "id": "str",
+ "isBuffered": bool,
+ "loggerType": "str",
+ "name": "str",
+ "resourceId": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.workspace_logger.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ logger_id="str",
+ if_match="str",
+ parameters={"credentials": {"str": "str"}, "description": "str", "isBuffered": bool, "loggerType": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_logger.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ logger_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_named_value_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_named_value_operations.py
new file mode 100644
index 000000000000..bb2037b816ae
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_named_value_operations.py
@@ -0,0 +1,149 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceNamedValueOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.workspace_named_value.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_named_value.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_named_value.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.workspace_named_value.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ named_value_id="str",
+ parameters={
+ "displayName": "str",
+ "id": "str",
+ "keyVault": {"identityClientId": "str", "secretIdentifier": "str"},
+ "name": "str",
+ "secret": bool,
+ "tags": ["str"],
+ "type": "str",
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_update(self, resource_group):
+ response = self.client.workspace_named_value.begin_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ named_value_id="str",
+ if_match="str",
+ parameters={
+ "displayName": "str",
+ "keyVault": {"identityClientId": "str", "secretIdentifier": "str"},
+ "secret": bool,
+ "tags": ["str"],
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_named_value.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ named_value_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_value(self, resource_group):
+ response = self.client.workspace_named_value.list_value(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_refresh_secret(self, resource_group):
+ response = self.client.workspace_named_value.begin_refresh_secret(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_named_value_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_named_value_operations_async.py
new file mode 100644
index 000000000000..13c2088493ff
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_named_value_operations_async.py
@@ -0,0 +1,156 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceNamedValueOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.workspace_named_value.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_named_value.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_named_value.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.workspace_named_value.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ named_value_id="str",
+ parameters={
+ "displayName": "str",
+ "id": "str",
+ "keyVault": {"identityClientId": "str", "secretIdentifier": "str"},
+ "name": "str",
+ "secret": bool,
+ "tags": ["str"],
+ "type": "str",
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_update(self, resource_group):
+ response = await (
+ await self.client.workspace_named_value.begin_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ named_value_id="str",
+ if_match="str",
+ parameters={
+ "displayName": "str",
+ "keyVault": {"identityClientId": "str", "secretIdentifier": "str"},
+ "secret": bool,
+ "tags": ["str"],
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_named_value.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ named_value_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_value(self, resource_group):
+ response = await self.client.workspace_named_value.list_value(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_refresh_secret(self, resource_group):
+ response = await (
+ await self.client.workspace_named_value.begin_refresh_secret(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ named_value_id="str",
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_operations.py
new file mode 100644
index 000000000000..84308edc2c98
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_operations.py
@@ -0,0 +1,60 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceNotificationOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.workspace_notification.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_notification.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_notification.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_operations_async.py
new file mode 100644
index 000000000000..ad5e0d75758c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_operations_async.py
@@ -0,0 +1,61 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceNotificationOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.workspace_notification.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_notification.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_notification.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_recipient_email_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_recipient_email_operations.py
new file mode 100644
index 000000000000..38e4e98d91be
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_recipient_email_operations.py
@@ -0,0 +1,78 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceNotificationRecipientEmailOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_notification(self, resource_group):
+ response = self.client.workspace_notification_recipient_email.list_by_notification(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_check_entity_exists(self, resource_group):
+ response = self.client.workspace_notification_recipient_email.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ email="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_notification_recipient_email.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ email="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_notification_recipient_email.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ email="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_recipient_email_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_recipient_email_operations_async.py
new file mode 100644
index 000000000000..05dffec20c7c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_recipient_email_operations_async.py
@@ -0,0 +1,79 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceNotificationRecipientEmailOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_notification(self, resource_group):
+ response = await self.client.workspace_notification_recipient_email.list_by_notification(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_check_entity_exists(self, resource_group):
+ response = await self.client.workspace_notification_recipient_email.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ email="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_notification_recipient_email.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ email="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_notification_recipient_email.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ email="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_recipient_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_recipient_user_operations.py
new file mode 100644
index 000000000000..1110f852fdb1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_recipient_user_operations.py
@@ -0,0 +1,78 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceNotificationRecipientUserOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_notification(self, resource_group):
+ response = self.client.workspace_notification_recipient_user.list_by_notification(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_check_entity_exists(self, resource_group):
+ response = self.client.workspace_notification_recipient_user.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_notification_recipient_user.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_notification_recipient_user.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_recipient_user_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_recipient_user_operations_async.py
new file mode 100644
index 000000000000..5bd9659c921f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_notification_recipient_user_operations_async.py
@@ -0,0 +1,79 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceNotificationRecipientUserOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_notification(self, resource_group):
+ response = await self.client.workspace_notification_recipient_user.list_by_notification(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_check_entity_exists(self, resource_group):
+ response = await self.client.workspace_notification_recipient_user.check_entity_exists(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_notification_recipient_user.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_notification_recipient_user.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ notification_name="str",
+ user_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_operations.py
new file mode 100644
index 000000000000..ef71772d35d8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_operations.py
@@ -0,0 +1,100 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.workspace.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ parameters={"description": "str", "displayName": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.workspace.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ if_match="str",
+ parameters={"description": "str", "displayName": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_operations_async.py
new file mode 100644
index 000000000000..f53228c8432c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_operations_async.py
@@ -0,0 +1,101 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.workspace.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ parameters={"description": "str", "displayName": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.workspace.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ if_match="str",
+ parameters={"description": "str", "displayName": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_policy_fragment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_policy_fragment_operations.py
new file mode 100644
index 000000000000..8719f529880c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_policy_fragment_operations.py
@@ -0,0 +1,112 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspacePolicyFragmentOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.workspace_policy_fragment.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_policy_fragment.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_policy_fragment.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.workspace_policy_fragment.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ id="str",
+ parameters={
+ "description": "str",
+ "format": "str",
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "type": "str",
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_policy_fragment.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_references(self, resource_group):
+ response = self.client.workspace_policy_fragment.list_references(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_policy_fragment_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_policy_fragment_operations_async.py
new file mode 100644
index 000000000000..210643ff3af2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_policy_fragment_operations_async.py
@@ -0,0 +1,115 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspacePolicyFragmentOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.workspace_policy_fragment.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_policy_fragment.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_policy_fragment.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.workspace_policy_fragment.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ id="str",
+ parameters={
+ "description": "str",
+ "format": "str",
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "type": "str",
+ "value": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_policy_fragment.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_references(self, resource_group):
+ response = await self.client.workspace_policy_fragment.list_references(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_policy_operations.py
new file mode 100644
index 000000000000..2581244556ec
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_policy_operations.py
@@ -0,0 +1,90 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspacePolicyOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_api(self, resource_group):
+ response = self.client.workspace_policy.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_policy_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_policy_operations_async.py
new file mode 100644
index 000000000000..83265dc04f94
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_policy_operations_async.py
@@ -0,0 +1,91 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspacePolicyOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_api(self, resource_group):
+ response = self.client.workspace_policy.list_by_api(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_api_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_api_link_operations.py
new file mode 100644
index 000000000000..4bd58ffc3027
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_api_link_operations.py
@@ -0,0 +1,79 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceProductApiLinkOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.workspace_product_api_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_product_api_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_product_api_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_link_id="str",
+ parameters={"apiId": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_product_api_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_api_link_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_api_link_operations_async.py
new file mode 100644
index 000000000000..a450f58bf85d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_api_link_operations_async.py
@@ -0,0 +1,80 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceProductApiLinkOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.workspace_product_api_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_product_api_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_product_api_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_link_id="str",
+ parameters={"apiId": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_product_api_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_group_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_group_link_operations.py
new file mode 100644
index 000000000000..bd9faa3391f1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_group_link_operations.py
@@ -0,0 +1,79 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceProductGroupLinkOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.workspace_product_group_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_product_group_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ group_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_product_group_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ group_link_id="str",
+ parameters={"groupId": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_product_group_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ group_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_group_link_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_group_link_operations_async.py
new file mode 100644
index 000000000000..ae218a5e53ea
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_group_link_operations_async.py
@@ -0,0 +1,80 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceProductGroupLinkOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.workspace_product_group_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_product_group_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ group_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_product_group_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ group_link_id="str",
+ parameters={"groupId": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_product_group_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ group_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_operations.py
new file mode 100644
index 000000000000..314eaf5041f4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_operations.py
@@ -0,0 +1,125 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceProductOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.workspace_product.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_product.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_product.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_product.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ parameters={
+ "approvalRequired": bool,
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "name": "str",
+ "state": "str",
+ "subscriptionRequired": bool,
+ "subscriptionsLimit": 0,
+ "terms": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.workspace_product.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ if_match="str",
+ parameters={
+ "approvalRequired": bool,
+ "description": "str",
+ "displayName": "str",
+ "state": "str",
+ "subscriptionRequired": bool,
+ "subscriptionsLimit": 0,
+ "terms": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_product.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_operations_async.py
new file mode 100644
index 000000000000..198ffdad9137
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_operations_async.py
@@ -0,0 +1,126 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceProductOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.workspace_product.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_product.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_product.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_product.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ parameters={
+ "approvalRequired": bool,
+ "description": "str",
+ "displayName": "str",
+ "id": "str",
+ "name": "str",
+ "state": "str",
+ "subscriptionRequired": bool,
+ "subscriptionsLimit": 0,
+ "terms": "str",
+ "type": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.workspace_product.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ if_match="str",
+ parameters={
+ "approvalRequired": bool,
+ "description": "str",
+ "displayName": "str",
+ "state": "str",
+ "subscriptionRequired": bool,
+ "subscriptionsLimit": 0,
+ "terms": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_product.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_policy_operations.py
new file mode 100644
index 000000000000..24e1d98807a1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_policy_operations.py
@@ -0,0 +1,95 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceProductPolicyOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.workspace_product_policy.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_product_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_product_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_product_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_product_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_policy_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_policy_operations_async.py
new file mode 100644
index 000000000000..e48d2831bac0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_product_policy_operations_async.py
@@ -0,0 +1,96 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceProductPolicyOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = await self.client.workspace_product_policy.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_product_policy.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_product_policy.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ policy_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_product_policy.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ policy_id="str",
+ parameters={"format": "xml", "id": "str", "name": "str", "type": "str", "value": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_product_policy.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ product_id="str",
+ policy_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_subscription_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_subscription_operations.py
new file mode 100644
index 000000000000..9dfa35d12af9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_subscription_operations.py
@@ -0,0 +1,166 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceSubscriptionOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.workspace_subscription.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_tag(self, resource_group):
+ response = self.client.workspace_subscription.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_subscription.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_subscription.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ parameters={
+ "allowTracing": bool,
+ "displayName": "str",
+ "ownerId": "str",
+ "primaryKey": "str",
+ "scope": "str",
+ "secondaryKey": "str",
+ "state": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.workspace_subscription.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ if_match="str",
+ parameters={
+ "allowTracing": bool,
+ "displayName": "str",
+ "expirationDate": "2020-02-20 00:00:00",
+ "ownerId": "str",
+ "primaryKey": "str",
+ "scope": "str",
+ "secondaryKey": "str",
+ "state": "str",
+ "stateComment": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_subscription.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_regenerate_primary_key(self, resource_group):
+ response = self.client.workspace_subscription.regenerate_primary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_regenerate_secondary_key(self, resource_group):
+ response = self.client.workspace_subscription.regenerate_secondary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_secrets(self, resource_group):
+ response = self.client.workspace_subscription.list_secrets(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_subscription_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_subscription_operations_async.py
new file mode 100644
index 000000000000..5c3d9abc58b1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_subscription_operations_async.py
@@ -0,0 +1,167 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceSubscriptionOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.workspace_subscription.list(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_tag(self, resource_group):
+ response = await self.client.workspace_subscription.get_entity_tag(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_subscription.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_subscription.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ parameters={
+ "allowTracing": bool,
+ "displayName": "str",
+ "ownerId": "str",
+ "primaryKey": "str",
+ "scope": "str",
+ "secondaryKey": "str",
+ "state": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.workspace_subscription.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ if_match="str",
+ parameters={
+ "allowTracing": bool,
+ "displayName": "str",
+ "expirationDate": "2020-02-20 00:00:00",
+ "ownerId": "str",
+ "primaryKey": "str",
+ "scope": "str",
+ "secondaryKey": "str",
+ "state": "str",
+ "stateComment": "str",
+ },
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_subscription.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_regenerate_primary_key(self, resource_group):
+ response = await self.client.workspace_subscription.regenerate_primary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_regenerate_secondary_key(self, resource_group):
+ response = await self.client.workspace_subscription.regenerate_secondary_key(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_secrets(self, resource_group):
+ response = await self.client.workspace_subscription.list_secrets(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ sid="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_api_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_api_link_operations.py
new file mode 100644
index 000000000000..2f70f67a61fb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_api_link_operations.py
@@ -0,0 +1,79 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceTagApiLinkOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.workspace_tag_api_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_tag_api_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_tag_api_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_link_id="str",
+ parameters={"apiId": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_tag_api_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_api_link_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_api_link_operations_async.py
new file mode 100644
index 000000000000..7c578bbad443
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_api_link_operations_async.py
@@ -0,0 +1,80 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceTagApiLinkOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.workspace_tag_api_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_tag_api_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_tag_api_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_link_id="str",
+ parameters={"apiId": "str", "id": "str", "name": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_tag_api_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_operation_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_operation_link_operations.py
new file mode 100644
index 000000000000..3c3373052f5a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_operation_link_operations.py
@@ -0,0 +1,79 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceTagOperationLinkOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.workspace_tag_operation_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_tag_operation_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ operation_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_tag_operation_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ operation_link_id="str",
+ parameters={"id": "str", "name": "str", "operationId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_tag_operation_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ operation_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_operation_link_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_operation_link_operations_async.py
new file mode 100644
index 000000000000..8459104e185d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_operation_link_operations_async.py
@@ -0,0 +1,80 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceTagOperationLinkOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.workspace_tag_operation_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_tag_operation_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ operation_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_tag_operation_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ operation_link_id="str",
+ parameters={"id": "str", "name": "str", "operationId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_tag_operation_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ operation_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_operations.py
new file mode 100644
index 000000000000..6c34100f1e31
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_operations.py
@@ -0,0 +1,106 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceTagOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_service(self, resource_group):
+ response = self.client.workspace_tag.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_entity_state(self, resource_group):
+ response = self.client.workspace_tag.get_entity_state(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_tag.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_tag.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ parameters={"displayName": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.workspace_tag.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ if_match="str",
+ parameters={"displayName": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_tag.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_operations_async.py
new file mode 100644
index 000000000000..36e2ad5b70ea
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_operations_async.py
@@ -0,0 +1,107 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceTagOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_service(self, resource_group):
+ response = self.client.workspace_tag.list_by_service(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get_entity_state(self, resource_group):
+ response = await self.client.workspace_tag.get_entity_state(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_tag.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_tag.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ parameters={"displayName": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.workspace_tag.update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ if_match="str",
+ parameters={"displayName": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_tag.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ if_match="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_product_link_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_product_link_operations.py
new file mode 100644
index 000000000000..d0629c0c20cd
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_product_link_operations.py
@@ -0,0 +1,79 @@
+# 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 pytest
+from azure.mgmt.apimanagement import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceTagProductLinkOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_product(self, resource_group):
+ response = self.client.workspace_tag_product_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.workspace_tag_product_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ product_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.workspace_tag_product_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ product_link_id="str",
+ parameters={"id": "str", "name": "str", "productId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.workspace_tag_product_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ product_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_product_link_operations_async.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_product_link_operations_async.py
new file mode 100644
index 000000000000..068b2ec913a6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_tests/test_api_management_workspace_tag_product_link_operations_async.py
@@ -0,0 +1,80 @@
+# 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 pytest
+from azure.mgmt.apimanagement.aio import ApiManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestApiManagementWorkspaceTagProductLinkOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(ApiManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_product(self, resource_group):
+ response = self.client.workspace_tag_product_link.list_by_product(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ api_version="2024-06-01-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.workspace_tag_product_link.get(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ product_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.workspace_tag_product_link.create_or_update(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ product_link_id="str",
+ parameters={"id": "str", "name": "str", "productId": "str", "type": "str"},
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.workspace_tag_product_link.delete(
+ resource_group_name=resource_group.name,
+ service_name="str",
+ workspace_id="str",
+ tag_id="str",
+ product_link_id="str",
+ api_version="2024-06-01-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/setup.py b/sdk/apimanagement/azure-mgmt-apimanagement/setup.py
index ba273ae4e388..6e06a94738de 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/setup.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/setup.py
@@ -75,6 +75,7 @@
},
install_requires=[
"isodate>=0.6.1",
+ "typing-extensions>=4.6.0",
"azure-common>=1.1",
"azure-mgmt-core>=1.3.2",
],